diff --git a/src/main.nim b/src/main.nim index 862d40c..bb22f78 100644 --- a/src/main.nim +++ b/src/main.nim @@ -1,5 +1,23 @@ -# This is just an example to get you started. A typical binary package -# uses this file as the main entry point of the application. +# src/dashinit.nim +import os, strutils +import subcommands/help +import subcommands/init + +proc main() = + let args = commandLineParams() + if args.len == 0: + init() + return + + let subcommand = args[0].toLower() + + case subcommand + of "help": + displayHelp() + of "init": + init() + else: + echo "Unknown argument '", subcommand, "'. Use 'help' for available commands." when isMainModule: - echo("Hello, World!") + main() diff --git a/src/subcommands/help.nim b/src/subcommands/help.nim new file mode 100644 index 0000000..e859dff --- /dev/null +++ b/src/subcommands/help.nim @@ -0,0 +1,33 @@ +# src/subcommands/help.nim +type + Command = tuple[ + cmd: string, + desc: string + ] + Argument = tuple[ + arg: string, + desc: string + ] + +var commands: seq[Command] = @[ + ("help", "Displays this help message"), + ("init", "Initialise a project directory with default settings"), +] + +var arguments: seq[Argument] = @[ + ("-h", "Displays this help message") +] + +proc displayHelp*() = + echo "dashinit - a powerful templating tool" + + echo "\nUsage:" + echo "\tdashinit [subcommand] [arguments]" + + echo "\nSubcommands:" + for command in commands: + echo "\t", command.cmd, "\t", command.desc + + echo "\nArguments:" + for argument in arguments: + echo "\t", argument.arg, "\t", argument.desc \ No newline at end of file diff --git a/src/subcommands/init.nim b/src/subcommands/init.nim new file mode 100644 index 0000000..50de29f --- /dev/null +++ b/src/subcommands/init.nim @@ -0,0 +1,2 @@ +proc init*() = + echo "Initialising Project..." \ No newline at end of file