use argh::FromArgs;
pub const CALCIT_VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(FromArgs, PartialEq, Debug, Clone)]
pub struct ToplevelCalcit {
#[argh(subcommand)]
pub subcommand: Option<CalcitCommand>,
#[argh(switch, short = 'w')]
pub watch: bool,
#[argh(switch)]
pub check_only: bool,
#[argh(switch)]
pub disable_stack: bool,
#[argh(switch)]
pub skip_arity_check: bool,
#[argh(switch)]
pub warn_dyn_method: bool,
#[argh(switch)]
pub trace_ffi: bool,
#[argh(option, default = "String::from(\"js-out/\")")]
pub emit_path: String,
#[argh(option)]
pub init_fn: Option<String>,
#[argh(option)]
pub reload_fn: Option<String>,
#[argh(option)]
pub entry: Option<String>,
#[argh(switch)]
pub reload_libs: bool,
#[argh(option)]
pub watch_dir: Option<String>,
#[argh(positional, default = "String::from(\"compact.cirru\")")]
pub input: String,
#[argh(switch)]
pub version: bool,
#[argh(switch)]
pub tips: bool,
#[argh(option)]
pub tips_level: Option<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum CalcitCommand {
EmitJs(EmitJsCommand),
EmitIr(EmitIrCommand),
Eval(EvalCommand),
Analyze(AnalyzeCommand),
Query(QueryCommand),
Docs(DocsCommand),
Cirru(CirruCommand),
Libs(LibsCommand),
Edit(EditCommand),
Tree(TreeCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "js")]
pub struct EmitJsCommand {
#[argh(switch, short = 'w')]
pub watch: bool,
#[argh(switch)]
pub check_only: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "ir")]
pub struct EmitIrCommand {
#[argh(switch, short = 'w')]
pub watch: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "eval")]
pub struct EvalCommand {
#[argh(positional)]
pub snippet: String,
#[argh(option)]
pub dep: Vec<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "analyze")]
pub struct AnalyzeCommand {
#[argh(subcommand)]
pub subcommand: AnalyzeSubcommand,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum AnalyzeSubcommand {
CallGraph(CallGraphCommand),
CountCalls(CountCallsCommand),
CheckExamples(CheckExamplesCommand),
CheckTypes(CheckTypesCommand),
JsEscape(JsEscapeCommand),
JsUnescape(JsUnescapeCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "js-escape")]
pub struct JsEscapeCommand {
#[argh(positional)]
pub symbol: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "js-unescape")]
pub struct JsUnescapeCommand {
#[argh(positional)]
pub symbol: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "check-types")]
pub struct CheckTypesCommand {
#[argh(option)]
pub ns: Option<String>,
#[argh(option)]
pub ns_prefix: Option<String>,
#[argh(option)]
pub only: Option<String>,
#[argh(switch)]
pub deps: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "check-examples")]
pub struct CheckExamplesCommand {
#[argh(option)]
pub ns: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "call-graph")]
pub struct CallGraphCommand {
#[argh(option)]
pub root: Option<String>,
#[argh(option)]
pub ns_prefix: Option<String>,
#[argh(switch)]
pub include_core: bool,
#[argh(option, default = "0")]
pub max_depth: usize,
#[argh(switch)]
pub show_unused: bool,
#[argh(option, default = "String::from(\"text\")")]
pub format: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "count-calls")]
pub struct CountCallsCommand {
#[argh(option)]
pub root: Option<String>,
#[argh(option)]
pub ns_prefix: Option<String>,
#[argh(switch)]
pub include_core: bool,
#[argh(option, default = "String::from(\"text\")")]
pub format: String,
#[argh(option, default = "String::from(\"count\")")]
pub sort: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "query")]
pub struct QueryCommand {
#[argh(subcommand)]
pub subcommand: QuerySubcommand,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum QuerySubcommand {
Ns(QueryNsCommand),
Defs(QueryDefsCommand),
Pkg(QueryPkgCommand),
Config(QueryConfigCommand),
Error(QueryErrorCommand),
Modules(QueryModulesCommand),
Def(QueryDefCommand),
Peek(QueryPeekCommand),
Examples(QueryExamplesCommand),
Find(QueryFindCommand),
Usages(QueryUsagesCommand),
Search(QuerySearchCommand),
SearchExpr(QuerySearchExprCommand),
Schema(QuerySchemaCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "schema")]
pub struct QuerySchemaCommand {
#[argh(positional)]
pub target: String,
#[argh(switch, short = 'j')]
pub json: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "ns")]
pub struct QueryNsCommand {
#[argh(positional)]
pub namespace: Option<String>,
#[argh(switch)]
pub deps: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "defs")]
pub struct QueryDefsCommand {
#[argh(positional)]
pub namespace: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "pkg")]
pub struct QueryPkgCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "config")]
pub struct QueryConfigCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "error")]
pub struct QueryErrorCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "modules")]
pub struct QueryModulesCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "def")]
pub struct QueryDefCommand {
#[argh(positional)]
pub target: String,
#[argh(switch, short = 'j')]
pub json: bool,
#[argh(option, default = "56")]
pub chunk_target_nodes: usize,
#[argh(option, default = "68")]
pub chunk_max_nodes: usize,
#[argh(option, default = "88")]
pub chunk_trigger_nodes: usize,
#[argh(switch)]
pub raw: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "peek")]
pub struct QueryPeekCommand {
#[argh(positional)]
pub target: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "examples")]
pub struct QueryExamplesCommand {
#[argh(positional)]
pub target: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "find")]
pub struct QueryFindCommand {
#[argh(positional)]
pub symbol: String,
#[argh(switch)]
pub deps: bool,
#[argh(switch)]
pub exact: bool,
#[argh(option, short = 'n', default = "20")]
pub limit: usize,
#[argh(option, long = "detail-offset", default = "0")]
pub detail_offset: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "usages")]
pub struct QueryUsagesCommand {
#[argh(positional)]
pub target: String,
#[argh(switch)]
pub deps: bool,
#[argh(option, long = "detail-offset", default = "0")]
pub detail_offset: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "search")]
pub struct QuerySearchCommand {
#[argh(positional)]
pub pattern: String,
#[argh(option, short = 'f', long = "filter")]
pub filter: Option<String>,
#[argh(switch)]
pub exact: bool,
#[argh(option, short = 'd', default = "0")]
pub max_depth: usize,
#[argh(option, short = 'p', long = "start-path")]
pub start_path: Option<String>,
#[argh(option, long = "entry")]
pub entry: Option<String>,
#[argh(option, long = "detail-offset", default = "0")]
pub detail_offset: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "search-expr")]
pub struct QuerySearchExprCommand {
#[argh(positional)]
pub pattern: String,
#[argh(option, short = 'f', long = "filter")]
pub filter: Option<String>,
#[argh(switch)]
pub exact: bool,
#[argh(option, short = 'd', default = "0")]
pub max_depth: usize,
#[argh(switch, short = 'j')]
pub json: bool,
#[argh(option, long = "entry")]
pub entry: Option<String>,
#[argh(option, long = "detail-offset", default = "0")]
pub detail_offset: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "docs")]
pub struct DocsCommand {
#[argh(subcommand)]
pub subcommand: DocsSubcommand,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum DocsSubcommand {
Search(DocsSearchCommand),
Read(DocsReadCommand),
Agents(DocsAgentsCommand),
ReadLines(DocsReadLinesCommand),
List(DocsListCommand),
CheckMd(DocsCheckMdCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "search")]
pub struct DocsSearchCommand {
#[argh(positional)]
pub keyword: String,
#[argh(option, short = 'c', default = "5")]
pub context: usize,
#[argh(option, short = 'f')]
pub filename: Option<String>,
#[argh(option)]
pub scope: Option<String>,
#[argh(option)]
pub module: Option<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "read")]
pub struct DocsReadCommand {
#[argh(positional)]
pub filename: String,
#[argh(positional)]
pub headings: Vec<String>,
#[argh(switch)]
pub no_subheadings: bool,
#[argh(switch)]
pub full: bool,
#[argh(switch)]
pub with_lines: bool,
#[argh(option)]
pub scope: Option<String>,
#[argh(option)]
pub module: Option<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "agents")]
pub struct DocsAgentsCommand {
#[argh(positional)]
pub headings: Vec<String>,
#[argh(switch)]
pub no_subheadings: bool,
#[argh(switch)]
pub full: bool,
#[argh(switch)]
pub with_lines: bool,
#[argh(switch)]
pub refresh: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "read-lines")]
pub struct DocsReadLinesCommand {
#[argh(positional)]
pub filename: String,
#[argh(option, short = 's', default = "0")]
pub start: usize,
#[argh(option, short = 'n', default = "80")]
pub lines: usize,
#[argh(option)]
pub scope: Option<String>,
#[argh(option)]
pub module: Option<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "list")]
pub struct DocsListCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "check-md")]
pub struct DocsCheckMdCommand {
#[argh(positional)]
pub file: String,
#[argh(option, short = 'd', default = "String::from(\"demos/compact.cirru\")")]
pub entry: String,
#[argh(option)]
pub dep: Vec<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "cirru")]
pub struct CirruCommand {
#[argh(subcommand)]
pub subcommand: CirruSubcommand,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum CirruSubcommand {
Parse(CirruParseCommand),
Format(CirruFormatCommand),
ParseEdn(CirruParseEdnCommand),
ShowGuide(CirruShowGuideCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "parse")]
pub struct CirruParseCommand {
#[argh(positional)]
pub code: String,
#[argh(switch, short = 'e', long = "expr-one")]
pub expr_one_liner: bool,
#[argh(switch, short = 'v', long = "validate")]
pub validate: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "format")]
pub struct CirruFormatCommand {
#[argh(positional)]
pub json: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "parse-edn")]
pub struct CirruParseEdnCommand {
#[argh(positional)]
pub edn: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "show-guide")]
pub struct CirruShowGuideCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "libs")]
pub struct LibsCommand {
#[argh(subcommand)]
pub subcommand: Option<LibsSubcommand>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum LibsSubcommand {
Readme(LibsReadmeCommand),
Search(LibsSearchCommand),
ScanMd(LibsScanMdCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "readme")]
pub struct LibsReadmeCommand {
#[argh(positional)]
pub package: String,
#[argh(positional)]
pub headings: Vec<String>,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(switch)]
pub no_subheadings: bool,
#[argh(switch)]
pub full: bool,
#[argh(switch)]
pub with_lines: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "search")]
pub struct LibsSearchCommand {
#[argh(positional)]
pub keyword: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "scan-md")]
pub struct LibsScanMdCommand {
#[argh(positional)]
pub module: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "edit")]
pub struct EditCommand {
#[argh(subcommand)]
pub subcommand: EditSubcommand,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum EditSubcommand {
Format(EditFormatCommand),
Def(EditDefCommand),
MvDef(EditMvDefCommand),
RmDef(EditRmDefCommand),
Doc(EditDocCommand),
Schema(EditSchemaCommand),
Examples(EditExamplesCommand),
AddExample(EditAddExampleCommand),
RmExample(EditRmExampleCommand),
AddNs(EditAddNsCommand),
RmNs(EditRmNsCommand),
Imports(EditImportsCommand),
AddImport(EditAddImportCommand),
RmImport(EditRmImportCommand),
NsDoc(EditNsDocCommand),
AddModule(EditAddModuleCommand),
RmModule(EditRmModuleCommand),
Config(EditConfigCommand),
Inc(EditIncCommand),
Cp(EditCpCommand),
Mv(EditMvNodeCommand),
Rename(EditRenameCommand),
SplitDef(EditSplitDefCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "format")]
pub struct EditFormatCommand {}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "def")]
pub struct EditDefCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(switch, long = "overwrite")]
pub overwrite: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "mv-def")]
pub struct EditMvDefCommand {
#[argh(positional)]
pub source: String,
#[argh(positional)]
pub target: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rm-def")]
pub struct EditRmDefCommand {
#[argh(positional)]
pub target: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "doc")]
pub struct EditDocCommand {
#[argh(positional)]
pub target: String,
#[argh(positional)]
pub doc: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "schema")]
pub struct EditSchemaCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(switch, long = "clear")]
pub clear: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "examples")]
pub struct EditExamplesCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(switch, long = "clear")]
pub clear: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "add-example")]
pub struct EditAddExampleCommand {
#[argh(positional)]
pub target: String,
#[argh(option, long = "at")]
pub at: Option<usize>,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rm-example")]
pub struct EditRmExampleCommand {
#[argh(positional)]
pub target: String,
#[argh(positional)]
pub index: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "add-ns")]
pub struct EditAddNsCommand {
#[argh(positional)]
pub namespace: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rm-ns")]
pub struct EditRmNsCommand {
#[argh(positional)]
pub namespace: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "imports")]
pub struct EditImportsCommand {
#[argh(positional)]
pub namespace: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "add-import")]
pub struct EditAddImportCommand {
#[argh(positional)]
pub namespace: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(switch, short = 'o', long = "overwrite")]
pub overwrite: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rm-import")]
pub struct EditRmImportCommand {
#[argh(positional)]
pub namespace: String,
#[argh(positional)]
pub source_ns: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "ns-doc")]
pub struct EditNsDocCommand {
#[argh(positional)]
pub namespace: String,
#[argh(positional)]
pub doc: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "add-module")]
pub struct EditAddModuleCommand {
#[argh(positional)]
pub module_path: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rm-module")]
pub struct EditRmModuleCommand {
#[argh(positional)]
pub module_path: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "config")]
pub struct EditConfigCommand {
#[argh(positional)]
pub key: String,
#[argh(positional)]
pub value: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "inc")]
pub struct EditIncCommand {
#[argh(option, long = "added-ns")]
pub added_ns: Vec<String>,
#[argh(option, long = "removed-ns")]
pub removed_ns: Vec<String>,
#[argh(option, long = "ns-updated")]
pub ns_updated: Vec<String>,
#[argh(option, long = "added")]
pub added: Vec<String>,
#[argh(option, long = "removed")]
pub removed: Vec<String>,
#[argh(option, long = "changed")]
pub changed: Vec<String>,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "tree")]
pub struct TreeCommand {
#[argh(subcommand)]
pub subcommand: TreeSubcommand,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand)]
pub enum TreeSubcommand {
Show(TreeShowCommand),
Replace(TreeReplaceCommand),
ReplaceLeaf(TreeReplaceLeafCommand),
Delete(TreeDeleteCommand),
InsertBefore(TreeInsertBeforeCommand),
InsertAfter(TreeInsertAfterCommand),
InsertChild(TreeInsertChildCommand),
AppendChild(TreeAppendChildCommand),
SwapNext(TreeSwapNextCommand),
SwapPrev(TreeSwapPrevCommand),
Unwrap(TreeUnwrapCommand),
Raise(TreeRaiseCommand),
Wrap(TreeWrapCommand),
TargetReplace(TreeTargetReplaceCommand),
Rewrite(TreeStructuralCommand),
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "show")]
pub struct TreeShowCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
#[argh(switch, short = 'j')]
pub json: bool,
#[argh(option, default = "56")]
pub chunk_target_nodes: usize,
#[argh(option, default = "68")]
pub chunk_max_nodes: usize,
#[argh(option, default = "88")]
pub chunk_trigger_nodes: usize,
#[argh(option, default = "1")]
pub chunk_expand_depth: usize,
#[argh(switch)]
pub raw: bool,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "cp")]
pub struct EditCpCommand {
#[argh(positional)]
pub target: String,
#[argh(option, long = "from")]
pub from: String,
#[argh(option, short = 'p', long = "path")]
pub path: String,
#[argh(option, long = "at", default = "String::from(\"after\")")]
pub at: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "mv")]
pub struct EditMvNodeCommand {
#[argh(positional)]
pub target: String,
#[argh(option, long = "from")]
pub from: String,
#[argh(option, short = 'p', long = "path")]
pub path: String,
#[argh(option, long = "at", default = "String::from(\"after\")")]
pub at: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rename")]
pub struct EditRenameCommand {
#[argh(positional)]
pub source: String,
#[argh(positional)]
pub new_name: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "split-def")]
pub struct EditSplitDefCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p', long = "path")]
pub path: String,
#[argh(option, short = 'n', long = "name")]
pub new_name: String,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "rewrite")]
pub struct TreeStructuralCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'w', long = "with")]
pub with: Vec<String>,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "target-replace")]
pub struct TreeTargetReplaceCommand {
#[argh(positional)]
pub target: String,
#[argh(option, long = "pattern")]
pub pattern: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "replace")]
pub struct TreeReplaceCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "replace-leaf")]
pub struct TreeReplaceLeafCommand {
#[argh(positional)]
pub target: String,
#[argh(option, long = "pattern")]
pub pattern: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "delete")]
pub struct TreeDeleteCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "insert-before")]
pub struct TreeInsertBeforeCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "insert-after")]
pub struct TreeInsertAfterCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "insert-child")]
pub struct TreeInsertChildCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "append-child")]
pub struct TreeAppendChildCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "swap-next")]
pub struct TreeSwapNextCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "swap-prev")]
pub struct TreeSwapPrevCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "unwrap")]
pub struct TreeUnwrapCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "raise")]
pub struct TreeRaiseCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}
#[derive(FromArgs, PartialEq, Debug, Clone)]
#[argh(subcommand, name = "wrap")]
pub struct TreeWrapCommand {
#[argh(positional)]
pub target: String,
#[argh(option, short = 'p')]
pub path: String,
#[argh(option, short = 'e', long = "code")]
pub code: Option<String>,
#[argh(option, short = 'f')]
pub file: Option<String>,
#[argh(option, short = 'j')]
pub json: Option<String>,
#[argh(switch, short = 'J', long = "json-input")]
pub json_input: bool,
#[argh(switch, long = "leaf")]
pub leaf: bool,
#[argh(option, short = 'd', default = "2")]
pub depth: usize,
}