We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f9a678 commit c61f05eCopy full SHA for c61f05e
1 file changed
examples/more/cli_tool.h#
@@ -0,0 +1,33 @@
1
+;; H# CLI Tool — HackerOS command line tool example
2
+;; Perfect Python script replacement
3
+
4
+use "std -> env" from "env"
5
6
+fn show_help() is
7
+ write("Usage: mytool [--verbose] [--output FILE] <input>")
8
+ write(" --verbose Show detailed output")
9
+ write(" --output Output file path")
10
+end
11
12
+fn main() is
13
+ let mut verbose: bool = false
14
+ let mut output: string = "output.txt"
15
+ let mut input: string = ""
16
17
+ ;; Parse command line arguments
18
+ ;; env::args() returns [string] array
19
+ let mut i: int = 0
20
+ while i < 10 is
21
+ ;; In real impl: iterate env::args()
22
+ ;; For demo: show usage
23
+ i += 1
24
+ end
25
26
+ if verbose is
27
+ write("[verbose] Processing...")
28
29
30
+ write("H# CLI Tool v0.1")
31
+ write("Output: " + output)
32
+ write("Done.")
33
0 commit comments