Skip to content

Commit

Permalink
Add flag usage to git demo.
Browse files Browse the repository at this point in the history
  • Loading branch information
moigagoo committed Dec 28, 2024
1 parent cf81faa commit 4671928
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions demo/git/commands/root.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ proc root*(context: Context): int =
quit "Invalid command. Run 'git --help' to see the available commands."

with context:
opt "version", "":
flag "version", "":
echo "Version 1.0.0"

opt "help", "h":
flag "help", "h":
echo "Usage: ..."

proc add*(context: Context): int =
Expand All @@ -22,11 +22,12 @@ proc add*(context: Context): int =
for filename in args:
echo "Adding " & filename
do:
echo "No filename provided"
return 1
quit("No filename provided", 1)

opt "tag", "T":
echo "Tag: " & val
do:
quit("Tag is mandatory", 1)

proc reset*(context: Context): int =
with context:
Expand Down

0 comments on commit 4671928

Please sign in to comment.