You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ jsonfiddle j2s -f yaml -i wireframe_full.yaml --name WireframeT | sed '/Wireframe\b/d; s/ `yaml:.*$//'| gofmt | tee WireframeT.go
66
71
package main
@@ -86,106 +91,16 @@ Wireframe:
86
91
License: MIT
87
92
```
88
93
94
+
</details>
95
+
89
96
The `jsonfiddle` is the JSON Fiddling tool that makes it easy to look at the JSON data from different aspects, which is [available here](https://github.com/go-jsonfile/jsonfiddle).
90
97
91
98
## Command line flag handling code auto-generation
92
99
93
100
Refer to
94
101
95
-
-[Command line flag handling code auto-generation](https://github.com/go-easygen/easygen#command-line-flag-handling-code-auto-generation), especially,
96
-
- the [cli based command line flag handling code auto-generation](https://github.com/go-easygen/easygen#cli-based).
97
-
- for the four different `UsageStyles` that can be used to control the `usage()` output, check out the [UsageStyle of package cli](https://github.com/go-easygen/wireframe/wiki/UsageStyle-of-package-cli) wiki.
98
-
99
-
### Auto-generated Command line flag handling showcase using wireframe
100
-
101
-
First of all, this is what auto-generated help looks like:
102
-
103
-
#### $ {{exec "wireframe" | color "sh"}}
104
-
105
-
This gives full help at root level.
106
-
107
-
There are also two sub-commands, which are:
108
-
109
-
#### $ {{shell "wireframe put" | color "sh"}}
110
-
111
-
The above gives sub-command `put` level help, and the next is for `get`:
112
-
113
-
#### $ {{shell "wireframe get" | color "sh"}}
114
-
115
-
The above gives sub-command `get` level help.
116
-
117
-
Before we see how it runs, let's take a look at how to define and get all the above. Here is the single source of CLI definition for all above:
118
-
119
-
<aname="cli.yaml"/>
120
-
121
-
#### {{cat "wireframe_cli.yaml" | color "yaml"}}
122
-
123
-
124
-
The above `yaml` definition is all it takes to get a wire-framed Go code to start with.
125
-
126
-
We don't need to jump into the generate code itself now, just take a look what we will get out of the box first:
This shows overriding settings from the self-config file using the environment variables. Note the value of `Host` now is taken from the environment variable, instead from the `wireframe_cfg.json` self-config file.
155
-
156
-
#### $ HOST=10.0.0.1 wireframe put -i /tmp/f -H 168.0.0.1
This shows overriding settings on the command line. Note the value of `Host` now is taken from the command line. So the priority of setting the `Host` value is, from higher priority to lower:
167
-
168
-
- command line
169
-
- environment variable
170
-
- self-config file
171
-
172
-
Three different levels.
173
-
174
-
#### $ wireframe get -o /tmp/f some more args
175
-
176
-
```sh
177
-
$ HOST=10.0.0.1 wireframe get -o /tmp/f some more args
This just shows how to make use of the extra arguments passed from the command line. Note the setting is a bit different between `put` and `get` regarding what is mandatory on the command line. I.e., for `get`, there much be some extra command line arguments.
102
+
[Command line flag handling code auto-generation](https://github.com/go-easygen/wireframe/wiki/Command-line-flag-handling-code-auto-generation#auto-gen)
187
103
188
-
Basically, the above functionalities are what we can get out of the box from the above [single source of CLI definition file](#cli.yaml) automatically, without a single line of customization code.
189
104
190
105
## github-create-release - Create Release in Github
0 commit comments