-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hoist): hoist can create anonymous versions of specs
- Loading branch information
Showing
2 changed files
with
146 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
use clap::Subcommand; | ||
use std::path::PathBuf; | ||
|
||
#[derive(Subcommand, Debug)] | ||
#[remain::sorted] | ||
pub enum Commands { | ||
AnonymizeSpecs(AnonymizeSpecsArgs), | ||
UploadAllSpecs(UploadAllSpecsArgs), | ||
UploadSpec(UploadSpecArgs), | ||
WriteAllSpecs(WriteAllSpecsArgs), | ||
WriteExistingModulesSpec(WriteExistingModulesSpecArgs), | ||
WriteSpec(WriteSpecArgs), | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
#[command(about = "Generate an anonymized version of target spec(s)")] | ||
pub struct AnonymizeSpecsArgs { | ||
#[arg(long, short = 'o', required = true)] | ||
pub out: PathBuf, | ||
|
||
#[arg( | ||
long, | ||
short = 't', | ||
required = true, | ||
help = "Path to the directory containing specs to anonymize" | ||
)] | ||
pub target_dir: PathBuf, | ||
|
||
#[arg( | ||
long, | ||
default_value = "100", | ||
help = "Maximum number of concurrent uploads." | ||
)] | ||
pub max_concurrent: usize, | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
#[command(about = "Upload all specs in {target_dir} to the module index")] | ||
pub struct UploadAllSpecsArgs { | ||
#[arg( | ||
long, | ||
short = 't', | ||
required = true, | ||
help = "Path to the directory containing specs to upload" | ||
)] | ||
pub target_dir: PathBuf, | ||
|
||
#[arg( | ||
long, | ||
default_value = "100", | ||
help = "Maximum number of concurrent uploads." | ||
)] | ||
pub max_concurrent: usize, | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
#[command(about = "Upload the spec {target} to the module index")] | ||
pub struct UploadSpecArgs { | ||
#[arg( | ||
long, | ||
short = 't', | ||
required = true, | ||
help = "Path to the spec to upload" | ||
)] | ||
pub target: PathBuf, | ||
|
||
#[arg( | ||
long, | ||
default_value = "100", | ||
help = "Maximum number of concurrent uploads." | ||
)] | ||
pub max_concurrent: usize, | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
#[command(about = "Get all built-ins an write out a hashmap with their name and schema id")] | ||
pub struct WriteExistingModulesSpecArgs { | ||
#[arg(long, short = 'o', required = true)] | ||
pub out: PathBuf, | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
#[command(about = "Get {spec_name} from the module index and write it to {out}")] | ||
pub struct WriteSpecArgs { | ||
#[arg(long, short = 's', required = true)] | ||
pub spec_name: String, | ||
#[arg(long, short = 'o', required = true)] | ||
pub out: PathBuf, | ||
} | ||
|
||
#[derive(clap::Args, Debug)] | ||
#[command(about = "Get all specs from the module index and write them to {out}")] | ||
pub struct WriteAllSpecsArgs { | ||
#[arg(long, short = 'o', required = true)] | ||
pub out: PathBuf, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters