-
-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathcatch-all-stdin
77 lines (56 loc) · 1.19 KB
/
catch-all-stdin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
creating user files in src
skipped src/root_command.sh (exists)
created ./cli
run ./cli --help to test your bash script
cli - Sample application
Usage:
cli [OPTIONS] [--] [FILE...]
cli --help | -h
cli --version | -v
Options:
--format, -f FORMAT
Specify file format
Allowed: csv, json
Default: json
--help, -h
Show this help
--version, -v
Show version number
Arguments:
FILE...
Path to one or more files. Reads from stdin if empty or "-".
Examples:
cli file1 file2 --format csv
cli --format csv file1 file2
cat file1 | cli --format csv
cat file* | cli - --format csv
args:
- ${args[--format]} = csv
other_args:
- ${other_args[*]} = file1 file2
- ${other_args[0]} = file1
- ${other_args[1]} = file2
collected file contents:
file1 content
file2 content
args:
- ${args[--format]} = csv
other_args:
- ${other_args[*]} = file1 file2
- ${other_args[0]} = file1
- ${other_args[1]} = file2
collected file contents:
file1 content
file2 content
args:
- ${args[--format]} = csv
collected file contents:
file1 content
args:
- ${args[--format]} = json
other_args:
- ${other_args[*]} = -
- ${other_args[0]} = -
collected file contents:
file1 content
file2 content