Skip to content

Commit

Permalink
fix: I said ALL GREEN!
Browse files Browse the repository at this point in the history
  • Loading branch information
Yohe-Am committed Dec 29, 2024
1 parent 7b7d8ea commit ce52bab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions modules/tasks/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class TasksModule extends ModuleBase<TasksLockEnt> {
visible_aliases: ["x"],
about: "Tasks module, execute your task programs.",
before_long_help: "The named tasks in your ghjkfile will be listed here.",
disable_help_subcommand: true,
sub_commands: [
...Object.keys(tcx.config.tasks)
.sort()
Expand All @@ -72,6 +73,7 @@ export class TasksModule extends ModuleBase<TasksLockEnt> {
value_name: "TASK ARGS",
trailing_var_arg: true,
allow_hyphen_values: true,
action: "Append",
},
},
action: async ({ args: { raw } }) => {
Expand Down
1 change: 1 addition & 0 deletions src/deno_systems/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const cliCommandBase = zod.object({
visible_aliases: zod.string().array().optional(),

hide: zod.boolean().optional(),
disable_help_subcommand: zod.boolean().optional(),

about: zod.string().optional(),
before_help: zod.string().optional(),
Expand Down
8 changes: 4 additions & 4 deletions src/ghjk/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ pub async fn cli() -> Res<std::process::ExitCode> {
};

for cmd in sys_cmds {
// apply styles again here due to propagation
// breaking for these dynamic subcommands for some reason
root_cmd = root_cmd.subcommand(cmd.styles(CLAP_STYLE));
root_cmd = root_cmd.subcommand(cmd);
}

debug!("checking argv matches");
Expand Down Expand Up @@ -314,7 +312,9 @@ async fn commands_from_systems(
systems: &host::GhjkfileSystems,
) -> Res<(Vec<clap::Command>, SysCmdActions)> {
fn inner(cmd: SystemCliCommand) -> (SysCmdAction, clap::Command) {
let mut clap_cmd = cmd.clap;
// apply styles here due to propagation
// breaking for these dynamic subcommands for some reason
let mut clap_cmd = cmd.clap.styles(CLAP_STYLE);
let mut sub_commands = IndexMap::new();
for (id, cmd) in cmd.sub_commands {
let (sub_sys_cmd, sub_cmd) = inner(cmd);
Expand Down
5 changes: 5 additions & 0 deletions src/ghjk/systems/deno/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ pub struct CliCommandDesc {
pub flags: Option<IndexMap<String, CliFlagDesc>>,
pub sub_commands: Option<Vec<CliCommandDesc>>,

pub disable_help_subcommand: Option<bool>,

pub action_cb_key: Option<String>,
}

Expand Down Expand Up @@ -45,6 +47,9 @@ impl CliCommandDesc {
if let Some(val) = self.before_long_help {
cmd = cmd.before_long_help(val)
}
if let Some(val) = self.disable_help_subcommand {
cmd = cmd.disable_help_subcommand(val)
}
let flag_ids = if let Some(val) = &self.flags {
let mut ids = ahash::HashSet::default();
for (id, desc) in val {
Expand Down

0 comments on commit ce52bab

Please sign in to comment.