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