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

Group flags by type #99

Open
brmzkw opened this issue Jul 28, 2023 · 0 comments
Open

Group flags by type #99

brmzkw opened this issue Jul 28, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@brmzkw
Copy link
Contributor

brmzkw commented Jul 28, 2023

We use cobra to parse arguments, which unfortunately does not allow to group flags together (see this issue).

The output of commands such as koyeb service create --help or koyeb service update --help could be improved. Instead of having all the flags sorted alphabetically:

Flags:
  -a, --app string                              Service application
      --checks strings                          Update service healthchecks (available for services of type "web" only)
                                                For HTTP healthchecks, use the format <PORT>:http:<PATH>, for example --checks 8080:http:/health
                                                For TCP healthchecks, use the format <PORT>:tcp, for example --checks 8080:tcp
                                                To delete a healthcheck, use !PORT, for example --checks '!8080'
      --docker string                           Docker image
      --docker-args strings                     Docker args
      --docker-command string                   Docker command
      --docker-entrypoint strings               Docker entrypoint
      --docker-private-registry-secret string   Docker private registry secret
      --env strings                             Update service environment variables using the format KEY=VALUE, for example --env FOO=bar
                                                To use the value of a secret as an environment variable, specify the secret name preceded by @, for example --env FOO=@bar
                                                To delete an environment variable, prefix its name with '!', for example --env '!FOO'
      --git string                              Git repository
      --git-branch string                       Git branch
      --git-build-command string                Buid command (legacy, prefer git-buildpack-build-command)
      --git-builder string                      Builder to use, either "buildpack" (default) or "docker" (default "buildpack")
      --git-buildpack-build-command string      Buid command
      --git-buildpack-run-command string        Run command
      --git-docker-args strings                 Arguments for the Docker CMD
      --git-docker-command string               Docker CMD
      --git-docker-dockerfile string            Dockerfile path
      --git-docker-entrypoint strings           Docker entrypoint
      --git-docker-target string                Docker target
      --git-no-deploy-on-push                   Disable new deployments creation when code changes are pushed on the configured branch
      --git-run-command string                  Run command (legacy, prefer git-buildpack-run-command)
      --git-workdir string                      Path to the sub-directory containing the code to build and deploy
  -h, --help                                    help for create
      --instance-type string                    Instance type (default "nano")
      --max-scale int                           Max scale (default 1)
      --min-scale int                           Min scale (default 1)
      --ports strings                           Update service ports (available for services of type "web" only) using the format PORT[:PROTOCOL], for example --port 80:http
                                                If no protocol is specified, it defaults to "http". Supported protocols are "http" and "http2"
                                                To delete an exposed port, prefix its number with '!', for example --port '!80'

      --regions strings                         Regions (default [fra])
      --routes strings                          Update service routes (available for services of type "web" only) using the format PATH[:PORT], for example '/foo:8080'
                                                If no port is specified, it defaults to 80
                                                To delete a route, use '!PATH', for example --route '!/foo'

      --type string                             Service type, either "web" or "worker" (default "web")

we could group the flags by type (source type, builder type), and have a description for each type, for example:

General flags:
  -a, --app string                              Service application
      --env strings                             Update service environment variables using the format KEY=VALUE, for example --env FOO=bar
                                                To use the value of a secret as an environment variable, specify the secret name preceded by @, for example --env FOO=@bar
                                                To delete an environment variable, prefix its name with '!', for example --env '!FOO'
  -h, --help                                    help for create
      --instance-type string                    Instance type (default "nano")
      --max-scale int                           Max scale (default 1)
      --min-scale int                           Min scale (default 1)
      --regions strings                         Regions (default [fra])
      --type string                             Service type, either "web" or "worker" (default "web")

Web services: the flags below can only be set for services with --type=web
      --checks strings                          Update service healthchecks (available for services of type "web" only)
                                                For HTTP healthchecks, use the format <PORT>:http:<PATH>, for example --checks 8080:http:/health
                                                For TCP healthchecks, use the format <PORT>:tcp, for example --checks 8080:tcp
                                                To delete a healthcheck, use !PORT, for example --checks '!8080'
      --ports strings                           Update service ports (available for services of type "web" only) using the format PORT[:PROTOCOL], for example --port 80:http
                                                If no protocol is specified, it defaults to "http". Supported protocols are "http" and "http2"
                                                To delete an exposed port, prefix its number with '!', for example --port '!80'
      --routes strings                          Update service routes (available for services of type "web" only) using the format PATH[:PORT], for example '/foo:8080'
                                                If no port is specified, it defaults to 80
                                                To delete a route, use '!PATH', for example --route '!/foo'
												
Flags to deploy a docker container:
      --docker string                           Docker image
      --docker-args strings                     Docker args
      --docker-command string                   Docker command
      --docker-entrypoint strings               Docker entrypoint
      --docker-private-registry-secret string   Docker private registry secret

Flags to deploy a GitHub repository:
      --git string                              Git repository
      --git-branch string                       Git branch
      --git-builder string                      Builder to use, either "buildpack" (default) or "docker" (default "buildpack")
      --git-no-deploy-on-push                   Disable new deployments creation when code changes are pushed on the configured branch
      --git-workdir string                      Path to the sub-directory containing the code to build and deplo

Flags to build a GitHub repository with the buildpack builder:
      --git-buildpack-build-command string      Buid command
      --git-build-command string                Buid command (legacy, prefer git-buildpack-build-command
      --git-buildpack-run-command string        Run command
      --git-run-command string                  Run command (legacy, prefer git-buildpack-run-command

Flags to build a GitHub repository with the Docker builder:
      --git-docker-args strings                 Arguments for the Docker CMD
      --git-docker-command string               Docker CMD
      --git-docker-dockerfile string            Dockerfile path
      --git-docker-entrypoint strings           Docker entrypoint
      --git-docker-target string                Docker target

I don't know how to do the grouping. Maybe could we check this PR, or check how Karmada did

@brmzkw brmzkw added the enhancement New feature or request label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant