Skip to content

Commit

Permalink
[TASK]: Re-format help
Browse files Browse the repository at this point in the history
  • Loading branch information
on3iro committed Jul 24, 2019
1 parent 8bddb24 commit ea7e49e
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
nimcache/
omt_save.yaml
omt.yaml
*OSX
*WIN
*LINUX
Binary file modified omt
Binary file not shown.
4 changes: 3 additions & 1 deletion src/createHandler.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import parseopt
import colorize

import types
from helpers import createOMTConfig
Expand All @@ -11,8 +12,9 @@ import constants
###########

proc showHelpAndQuit() =
echo "\nomt".fgLightBlue & " create".fgGreen & " <projectName>"

echo """
omt create <projectName>
Creates a directory by the specified project name and a default
omt.yaml configuration.
Expand Down
30 changes: 16 additions & 14 deletions src/getHandler.nim
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from random import randomize
import parseopt
import yaml/serialization, streams
import colorize

from helpers import
retrieveOMTConfigFromFile,
Expand All @@ -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=<yamlFormedListString>, --string=<yamlFormedListString>
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 & "=<yamlFormedListString>, " & "--string".fgMagenta & "=<yamlFormedListString>"
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=<nameOfOutputFile>, --output=<nameOfOutputFile>
Saves the configuration to the specified outputfile instead of omt_save.yaml
"""
echo "\t-o".fgMagenta & "=<nameOfOutputFile>, " & "--output".fgMagenta & "=<nameOfOutputFile>"
echo "\t\tSaves the configuration to the specified outputfile instead of omt_save.yaml"
echo "\n"
quit()

proc getConfigFromFile(path: string): ThingList =
Expand Down
30 changes: 18 additions & 12 deletions src/helpHandler.nim
Original file line number Diff line number Diff line change
@@ -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 <projectName> - 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 <undo> 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 &
" <projectName> - 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 <undo> will move the last picked thing back to the 'thingList'"
echo "\n"
quit()
8 changes: 4 additions & 4 deletions src/undoHandler.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import parseopt
import colorize

import types
from helpers import retrieveOMTConfigFromFile, writeSaveFile
Expand All @@ -10,14 +11,13 @@ import constants
###########

proc showHelpAndQuit() =
echo "\nomt".fgLightBlue & " undo".fgGreen
echo """
omt undo
Moves the last item from the <pickedThings> list of an omt configuration back to its <thingsList>.
-f=<fileName>, --file=<fileName>
Uses the specified YAML file instead of the default 'omt_save.yaml'.
"""
echo "\t-f".fgMagenta & "=<fileName>, " & "--file".fgMagenta & "=<fileName>"
echo "\t\tUses the specified YAML file instead of the default 'omt_save.yaml'."
quit()

###########
Expand Down

0 comments on commit ea7e49e

Please sign in to comment.