diff --git a/.gitignore b/.gitignore index 34a0fc0..d398428 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ nimcache/ omt_save.yaml omt.yaml +*OSX +*WIN +*LINUX diff --git a/omt b/omt index 9de28bd..d8c17e6 100755 Binary files a/omt and b/omt differ diff --git a/src/createHandler.nim b/src/createHandler.nim index cd23484..050430d 100644 --- a/src/createHandler.nim +++ b/src/createHandler.nim @@ -1,5 +1,6 @@ import os import parseopt +import colorize import types from helpers import createOMTConfig @@ -11,8 +12,9 @@ import constants ########### proc showHelpAndQuit() = + echo "\nomt".fgLightBlue & " create".fgGreen & " " + echo """ -omt create Creates a directory by the specified project name and a default omt.yaml configuration. diff --git a/src/getHandler.nim b/src/getHandler.nim index d9ab568..0e508b0 100644 --- a/src/getHandler.nim +++ b/src/getHandler.nim @@ -1,6 +1,7 @@ from random import randomize import parseopt import yaml/serialization, streams +import colorize from helpers import retrieveOMTConfigFromFile, @@ -17,25 +18,26 @@ import constants ########### proc showHelpAndQuit() = + echo "\nomt".fgBlue & " get".fgGreen echo """ -omt get [flags] - Gets a random value from a 'thingList' either by using a local configuraition or a provided file/string. - - -d, --dry - Runs the command as dryrun not writing an output save file +Gets a random value from a 'thingList' either by using a local configuraition or a provided file/string. + """ - -s=, --string= - Uses the provided list string instead of a config file. - Careful: This might still overwrite an existing omt_save.yaml if you - do not run the command as dryrun (see [-d])! + echo "\t-d".fgMagenta & ", " & "--dry".fgMagenta + echo "\t\tRuns the command as dryrun not writing an output save file" + echo "\n" - Example: - omt get -s="['a', 'b', 'c']" + echo "\t-s".fgMagenta & "=, " & "--string".fgMagenta & "=" + echo "\t\tUses the provided list string instead of a config file." + echo "\t\tCareful: This might still overwrite an existing omt_save.yaml if you do not run the command as dryrun (see [-d])!" + echo "\t\tExample:" + echo "\t\t\tomt get -s=\"['a', 'b', 'c']\"" + echo "\n" - -o=, --output= - Saves the configuration to the specified outputfile instead of omt_save.yaml - """ + echo "\t-o".fgMagenta & "=, " & "--output".fgMagenta & "=" + echo "\t\tSaves the configuration to the specified outputfile instead of omt_save.yaml" + echo "\n" quit() proc getConfigFromFile(path: string): ThingList = diff --git a/src/helpHandler.nim b/src/helpHandler.nim index 3f6062f..a1b7691 100644 --- a/src/helpHandler.nim +++ b/src/helpHandler.nim @@ -1,25 +1,31 @@ +import colorize + proc showHelp*(): void = echo """ omt (one more thing) is a simple CLI tool to get random strings from lists. By default omt is looking for a configuration file called 'omt.yaml' inside the directory the command is called. - ##### Configuration ##### - - An omt config should be written in YAML and consists of two parts: +# Configuration - thingList - a list of strings where omt randomly picks values from - pickedThings - this list could be empty (it will contain picked values in a separate save file after 'omt get' has been run at least once). +An omt config should be written in YAML and consists of two parts: + thingList - a list of strings where omt randomly picks values from + pickedThings - this list could be empty (it will contain picked values in a separate save file after 'omt get' has been run at least once). - ##### Commands ##### - omt can be called with the following commands. Appending the '-h' or '--help' flag will show more information for each respective command. +# Commands - help - shows this help - create - creates a directory with an empty omt.yaml config - get - Gets a random value from the thingList and by default writes the omt_save.yaml file. - reset - gets rid of omt_save.yaml file. Has to be called inside an omt project. - undo - If an omt_save.yaml file exists inside the current directory will move the last picked thing back to the 'thingList' +omt can be called with the following commands. Appending the '-h' or '--help' flag will show more information for each respective command. """ + echo "\thelp".fgGreen & " - shows this help" + echo "\tcreate".fgGreen & + " - creates a directory with an empty omt.yaml config" + echo "\tget".fgGreen & + " - Gets a random value from the thingList and by default writes the omt_save.yaml file." + echo "\treset".fgGreen & + " - gets rid of omt_save.yaml file. Has to be called inside an omt project." + echo "\tundo".fgGreen & + " - If an omt_save.yaml file exists inside the current directory will move the last picked thing back to the 'thingList'" + echo "\n" quit() diff --git a/src/undoHandler.nim b/src/undoHandler.nim index bbc1bb9..f946b1f 100644 --- a/src/undoHandler.nim +++ b/src/undoHandler.nim @@ -1,4 +1,5 @@ import parseopt +import colorize import types from helpers import retrieveOMTConfigFromFile, writeSaveFile @@ -10,14 +11,13 @@ import constants ########### proc showHelpAndQuit() = + echo "\nomt".fgLightBlue & " undo".fgGreen echo """ -omt undo Moves the last item from the list of an omt configuration back to its . - --f=, --file= -Uses the specified YAML file instead of the default 'omt_save.yaml'. """ + echo "\t-f".fgMagenta & "=, " & "--file".fgMagenta & "=" + echo "\t\tUses the specified YAML file instead of the default 'omt_save.yaml'." quit() ###########