Skip to content

Commit

Permalink
feat(mcl.commands.add_task): add help for add_task
Browse files Browse the repository at this point in the history
  • Loading branch information
alehander92 committed Oct 7, 2024
1 parent 8651633 commit daab5d5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
8 changes: 5 additions & 3 deletions packages/mcl/src/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import std.logger : infof, errorf, LogLevel;

import mcl.utils.path : rootDir;
import mcl.utils.tui : bold;

import cmds = mcl.commands;

alias supportedCommands = imported!`std.traits`.AliasSeq!(
Expand Down Expand Up @@ -73,8 +72,11 @@ int wrongUsage(string error)
{
writefln("Error: %s.", error);
writeln("Usage:\n");
static foreach (cmd; supportedCommands)
static foreach (cmd; supportedCommands) {
writefln(" mcl %s", __traits(identifier, cmd));

static if (__traits(identifier, cmd) == "add_task") {
cmds.writeAddTaskHelp();
}
}
return 1;
}
2 changes: 1 addition & 1 deletion packages/mcl/src/src/mcl/commands/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ public import mcl.commands.shard_matrix : shard_matrix;
public import mcl.commands.ci : ci;
public import mcl.commands.host_info : host_info;
public import mcl.commands.machine_create : machine_create;
public import mcl.commands.add_task : add_task;
public import mcl.commands.add_task : add_task, writeAddTaskHelp;
26 changes: 26 additions & 0 deletions packages/mcl/src/src/mcl/utils/add_task.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export void add_task(string[] args)
if (i < 2) {
continue; // ignore mcl and `add_task` command args
}
else if (arg == "--help")
{
writeAddTaskHelp();
return;
}
else if (i == 2)
{
taskManager.params.taskName = arg;
Expand All @@ -34,6 +39,27 @@ export void add_task(string[] args)
taskManager.addTaskToCoda();
}

export void writeAddTaskHelp() {
writeln(" mcl add_task <task-title> [<username/priority/status/milestone/estimate/tshirt-size> ..]");
writeln(" <username> is `@<name>` (might be a shorter name if registered in mcl_config.json)");
writeln(" <priority> is highest / high / normal / low");
writeln(" <status> is backlog / ready (for ready to start) / progress (for in progress) / done / blocker / paused / cancelled");
writeln(" <milestone> is project-specific, but can be auto-recognized based on shorter names in mcl_config.json");
writeln(" <estimate> is time(days) estimate, needs explicit `--estimate=..` for now");
writeln(" <tshirt-size> is S / M / L / XL");
writeln("");
writeln(" for all you can also pass explicit flag like `--priority=<value>");
writeln("");
writeln(" examples (with a hypothetical mcl_config.json):");
writeln(" mcl add_task \"test task\" @Paul low progress beta M");
writeln(" mcl add_task \"test task 2\" @Paul v1 L");
writeln(" mcl add_task \"test task 3\" @John done normal M beta");
writeln(" mcl add_task \"test task 4\" M backlog @John");
writeln(" mcl add_task \"test task 5\"");
writeln(" mcl add_task \"test task 6\" @Paul --priority=low backlog");
writeln(" mcl add_task \"test task 7\" @Paul --priority=low --status=backlog");
}

struct TaskConfig {
string codaApiToken;
string[string] userNames;
Expand Down

0 comments on commit daab5d5

Please sign in to comment.