mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 14:29:45 +00:00
add --include-private to db dump rpc
This commit is contained in:
@@ -182,8 +182,18 @@ pub enum RevisionsRes {
|
|||||||
Dump(Dump),
|
Dump(Dump),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Serialize, Parser)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
|
#[command(rename_all = "kebab-case")]
|
||||||
|
pub struct CliDumpParams {
|
||||||
|
path: Option<PathBuf>,
|
||||||
|
}
|
||||||
|
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
async fn cli_dump(ctx: CliContext, DumpParams { path }: DumpParams) -> Result<Dump, RpcError> {
|
async fn cli_dump(
|
||||||
|
ctx: CliContext,
|
||||||
|
CliDumpParams { path }: CliDumpParams,
|
||||||
|
) -> Result<Dump, RpcError> {
|
||||||
let dump = if let Some(path) = path {
|
let dump = if let Some(path) = path {
|
||||||
PatchDb::open(path).await?.dump(&ROOT).await
|
PatchDb::open(path).await?.dump(&ROOT).await
|
||||||
} else {
|
} else {
|
||||||
@@ -197,15 +207,23 @@ async fn cli_dump(ctx: CliContext, DumpParams { path }: DumpParams) -> Result<Du
|
|||||||
#[serde(rename_all = "kebab-case")]
|
#[serde(rename_all = "kebab-case")]
|
||||||
#[command(rename_all = "kebab-case")]
|
#[command(rename_all = "kebab-case")]
|
||||||
pub struct DumpParams {
|
pub struct DumpParams {
|
||||||
path: Option<PathBuf>,
|
#[arg(long = "include-private", short = 'p')]
|
||||||
|
#[serde(default)]
|
||||||
|
include_private: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[command(
|
pub async fn dump(
|
||||||
// custom_cli(cli_dump(async, context(CliContext))),
|
ctx: RpcContext,
|
||||||
// display(display_serializable)
|
DumpParams { include_private }: DumpParams,
|
||||||
// )]
|
) -> Result<Dump, Error> {
|
||||||
pub async fn dump(ctx: RpcContext, _: DumpParams) -> Result<Dump, Error> {
|
Ok(ctx
|
||||||
Ok(ctx.db.dump(&*PUBLIC).await)
|
.db
|
||||||
|
.dump(&if include_private {
|
||||||
|
ROOT
|
||||||
|
} else {
|
||||||
|
PUBLIC.borrowed()
|
||||||
|
})
|
||||||
|
.await)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(skip_all)]
|
#[instrument(skip_all)]
|
||||||
|
|||||||
2
patch-db
2
patch-db
Submodule patch-db updated: 899c63afb5...3dc11afd46
Reference in New Issue
Block a user