Work on help

This commit is contained in:
Sangelo 2023-10-05 20:11:08 +02:00
parent ebf299f140
commit 215d807a3d

View file

@ -1,10 +1,12 @@
# src/subcommands/help.nim # src/commands/help.nim
import terminal
type type
Command = tuple[ Command = tuple[
cmd: string, cmd: string,
desc: string desc: string
] ]
Argument = tuple[ Option = tuple[
arg: string, arg: string,
desc: string desc: string
] ]
@ -12,22 +14,28 @@ type
var commands: seq[Command] = @[ var commands: seq[Command] = @[
("help", "Displays this help message"), ("help", "Displays this help message"),
("init", "Initialise a project directory with default settings"), ("init", "Initialise a project directory with default settings"),
("template", "Initialise a project directory with default settings"),
] ]
var arguments: seq[Argument] = @[ var options: seq[Option] = @[
("-h", "Displays this help message") ("-h", "Displays this help message")
] ]
proc displayHelp*() = proc displayHelp*() =
echo "dashinit - a powerful templating tool" echo "dashinit - a powerful templating tool"
echo "\nUsage:" echo "\nUsage:"
echo "\tdashinit [subcommand] [arguments]" styledEcho styleBright, " dashinit", resetStyle, " [subcommand] [arguments]"
echo "\nSubcommands:" echo "\nSubcommands:"
for command in commands: for command in commands:
echo "\t", command.cmd, "\t", command.desc styledEcho " ", styleBright, command.cmd, resetStyle, " \t", command.desc
echo "\nArguments:" echo "\nOptions:"
for argument in arguments: for option in options:
echo "\t", argument.arg, "\t", argument.desc styledEcho " ", styleBright, option.arg, resetStyle, " \t", option.desc
echo "\nExamples:"
echo " dashinit\t\t\tInitialises using default settings."
styledEcho " ", "dashinit ", "template get ", fgBlue, "<url>", resetStyle, "\tGets a template from the internet"
# styledEcho styleBright, fgGreen, "[PASS]", resetStyle, fgGreen, " Yay!"