mirror of
https://github.com/mikefarah/yq.git
synced 2024-12-19 20:19:04 +00:00
add help description
This commit is contained in:
parent
b2fe3e6738
commit
6e35356a84
@ -82,6 +82,8 @@ docker run -it -v ${PWD}:/workdir mikefarah/yq sh
|
||||
Check out the [documentation](http://mikefarah.github.io/yq/) for more detailed and advanced usage.
|
||||
|
||||
```
|
||||
yq is a lightweight and portable command-line YAML processor. It aims to be the jq or sed of yaml files.
|
||||
|
||||
Usage:
|
||||
yq [flags]
|
||||
yq [command]
|
||||
@ -91,9 +93,9 @@ Available Commands:
|
||||
help Help about any command
|
||||
merge yq m [--inplace/-i] [--doc/-d index] [--overwrite/-x] [--append/-a] sample.yaml sample2.yaml
|
||||
new yq n [--script/-s script_file] a.b.c newValue
|
||||
prefix yq p [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
||||
read yq r [--doc/-d index] sample.yaml a.b.c
|
||||
write yq w [--inplace/-i] [--script/-s script_file] [--doc/-d index] sample.yaml a.b.c newValue
|
||||
prefix yq p [--inplace/-i] [--doc/-d index] sample.yaml a.b.c
|
||||
|
||||
Flags:
|
||||
-h, --help help for yq
|
||||
|
@ -24,7 +24,18 @@ func TestRootCmd(t *testing.T) {
|
||||
if !strings.Contains(result.Output, "Usage:") {
|
||||
t.Error("Expected usage message to be printed out, but the usage message was not found.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootCmd_Help(t *testing.T) {
|
||||
cmd := getRootCommand()
|
||||
result := runCmd(cmd, "--help")
|
||||
if result.Error != nil {
|
||||
t.Error(result.Error)
|
||||
}
|
||||
|
||||
if !strings.Contains(result.Output, "yq is a lightweight and portable command-line YAML processor. It aims to be the jq or sed of yaml files.") {
|
||||
t.Error("Expected usage message to be printed out, but the usage message was not found.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootCmd_VerboseLong(t *testing.T) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,42 +2,42 @@
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>None</loc>
|
||||
<lastmod>2019-04-29</lastmod>
|
||||
<lastmod>2019-05-14</lastmod>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
Binary file not shown.
4
yq.go
4
yq.go
@ -40,7 +40,9 @@ func main() {
|
||||
func newCommandCLI() *cobra.Command {
|
||||
yaml.DefaultMapType = reflect.TypeOf(yaml.MapSlice{})
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "yq",
|
||||
Use: "yq",
|
||||
Short: "yq is a lightweight and portable command-line YAML processor.",
|
||||
Long: `yq is a lightweight and portable command-line YAML processor. It aims to be the jq or sed of yaml files.`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
if version {
|
||||
cmd.Print(GetVersionDisplay())
|
||||
|
Loading…
Reference in New Issue
Block a user