Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(doc): short as command and fix some worker command description #3341

Merged
merged 1 commit into from
Sep 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions engine/worker/cmd_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ Here, an example of a script inside a CDS Job using the cache feature:
# put in cache the updated .m2/ directory
worker cache push $tag .m2/


`,
Short: "Inside a project, you can create or retrieve a cache from your worker with a tag",
}
cmdCacheRoot.AddCommand(cmdCachePush(w), cmdCachePull(w))

Expand Down
11 changes: 9 additions & 2 deletions engine/worker/cmd_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@ func cmdDownload(w *currentWorker) *cobra.Command {
Inside a job, there are two ways to download an artifact:

* with a step using action Download Artifacts
* with a step script (https://ovh.github.io/cds/workflows/pipelines/actions/builtin/script/), using the worker command: ` + "`worker download --tag=<tag> <path>`" + `
* with a step script (https://ovh.github.io/cds/workflows/pipelines/actions/builtin/script/), using the worker command.

Worker Command:

worker download --tag=<tag> <path>

Example:

worker download --pattern="files.*.yml"

#theses two commands have the same result:
Theses two commands have the same result:

worker download
worker download --workflow={{.cds.workflow}} --number={{.cds.run.number}}

Expand Down
1 change: 0 additions & 1 deletion engine/worker/cmd_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ var cmdExport = &cobra.Command{
Long: `
Inside a step script (https://ovh.github.io/cds/workflows/pipelines/actions/builtin/script/), you can create a build variable with the worker command:

# worker export <varname> <value>
worker export foo bar


Expand Down
7 changes: 2 additions & 5 deletions engine/worker/cmd_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ type keyResponse struct {

func cmdKey(w *currentWorker) *cobra.Command {
cmdKeyRoot := &cobra.Command{
Use: "key",
Long: `

`,
Short: "Inside a step script you can install/uninstall a ssh key generated in CDS in your ssh environment",
Use: "key",
Long: "Inside a step script you can install/uninstall a ssh key generated in CDS in your ssh environment",
}
cmdKeyRoot.AddCommand(cmdKeyInstall(w))

Expand Down
7 changes: 4 additions & 3 deletions engine/worker/cmd_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (

func cmdRegister(w *currentWorker) *cobra.Command {
var cmdRegister = &cobra.Command{
Use: "register",
Short: "worker register",
Run: cmdRegisterRun(w),
Use: "register",
Long: "worker register is a subcommand used by hatchery. This is not directly useful for end user",
Hidden: true, // user should not use this command directly
Run: cmdRegisterRun(w),
}
initFlagsRun(cmdRegister)
return cmdRegister
Expand Down
1 change: 0 additions & 1 deletion engine/worker/cmd_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
func cmdRun(w *currentWorker) *cobra.Command {
c := &cobra.Command{
Use: "run",
Short: "worker run.",
Hidden: true, // user should not use this command directly
Run: runCmd(w),
}
Expand Down
14 changes: 12 additions & 2 deletions engine/worker/cmd_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ import (
func cmdUpdate(w *currentWorker) *cobra.Command {
c := &cobra.Command{
Use: "update",
Short: "Update worker from CDS API or from CDS Release",
Run: updateCmd(w),
Short: "worker update [flags]",
Long: `Update worker from CDS API or from CDS Release

Update from Github:

worker update --from-github

Update from your CDS API:

worker update --api https://your-cds-api.localhost
`,
Run: updateCmd(w),
}
c.Flags().Bool(flagFromGithub, false, "Update binary from latest github release")
c.Flags().String(flagAPI, "", "URL of CDS API")
Expand Down
3 changes: 1 addition & 2 deletions engine/worker/cmd_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ Inside a job, there are two ways to upload an artifact:
* with a step using action Upload Artifacts
* with a step script (https://ovh.github.io/cds/workflows/pipelines/actions/builtin/script/), using the worker command: ` + "`worker upload <path>`" + `

# worker upload --tag=<tag> <path>
worker upload --tag={{.cds.version}} {{.cds.workspace}}/files*.yml
` + "`worker upload --tag={{.cds.version}} {{.cds.workspace}}/files*.yml`" + `

`,
Run: uploadCmd(w),
Expand Down
3 changes: 3 additions & 0 deletions sdk/doc/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ func genMarkdownTreeCustom(cmd *cobra.Command, rootdir string, filePrepender, li
if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
continue
}
if c.Short != "" {
c.Short = fmt.Sprintf("`%s`", c.Short)
}
if err := genMarkdownTreeCustom(c, rootdir, filePrepender, linkHandler); err != nil {
return err
}
Expand Down