We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c8b5374 + 1198f4a commit 8aed1b1Copy full SHA for 8aed1b1
examples/spork_47argparse_47argparse.janet
@@ -0,0 +1,23 @@
1
+(import spork)
2
+
3
+(def argparse-params
4
+ ["An example CLI tool."
5
+ "my-flag" {:kind :flag
6
+ :short "f"
7
+ :help "set my-flag"}
8
+ "my-opt" {:kind :option
9
+ :short "o"
10
+ :help "Value for option"
11
+ :default "DEFAULT VALUE"}
12
+ "my-req" {:kind :option
13
+ :short "r"
14
+ :required true}])
15
16
+(def cli-args (spork/argparse/argparse ;argparse-params))
17
18
+(unless cli-args
19
+ (os/exit 1))
20
21
+(print "flag: " (get cli-args "my-flag"))
22
+(print "my-opt: " (get cli-args "my-opt"))
23
+(print "my-req: " (get cli-args "my-req"))
0 commit comments