Skip to content

Commit

Permalink
Merge pull request #88 from Sn0rt/add-help
Browse files Browse the repository at this point in the history
Help: with more help information (Issues #13)
  • Loading branch information
xiekeyang authored Nov 29, 2016
2 parents b809c3b + 9624729 commit 421458f
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/oci-create-runtime-bundle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ It is strongly recommended to keep the default value.`,
&v.version, "version", "v", false,
`Print version information and exit`,
)

origHelp := cmd.HelpFunc()

cmd.SetHelpFunc(func(c *cobra.Command, args []string) {
origHelp(c, args)
stdout.Println("\nMore information:")
stdout.Printf("\treferences\t%s\n", image.SpecURL)
stdout.Printf("\tbug report\t%s\n", image.IssuesURL)
})

return cmd
}

Expand Down
9 changes: 9 additions & 0 deletions cmd/oci-image-validate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ func newValidateCmd(stdout, stderr *log.Logger) *cobra.Command {
`Print version information and exit`,
)

origHelp := cmd.HelpFunc()

cmd.SetHelpFunc(func(c *cobra.Command, args []string) {
origHelp(c, args)
stdout.Println("\nMore information:")
stdout.Printf("\treferences\t%s\n", image.SpecURL)
stdout.Printf("\tbug report\t%s\n", image.IssuesURL)
})

return cmd
}

Expand Down
10 changes: 10 additions & 0 deletions cmd/oci-unpack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ func newUnpackCmd(stdout, stderr *log.Logger) *cobra.Command {
&v.version, "version", "v", false,
`Print version information and exit`,
)

origHelp := cmd.HelpFunc()

cmd.SetHelpFunc(func(c *cobra.Command, args []string) {
origHelp(c, args)
stdout.Println("\nMore information:")
stdout.Printf("\treferences\t%s\n", image.SpecURL)
stdout.Printf("\tbug report\t%s\n", image.IssuesURL)
})

return cmd
}

Expand Down
21 changes: 21 additions & 0 deletions image/project.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2016 The Linux Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package image

// SpecURL is the URL for the image-spec repository
var SpecURL = "https://github.com/opencontainers/image-spec"

// IssuesURL is the URL for the issues of image-tools
var IssuesURL = "https://github.com/opencontainers/image-tools/issues"

0 comments on commit 421458f

Please sign in to comment.