packet icon indicating copy to clipboard operation
packet copied to clipboard

add '--project ABCDEF' command line flag

Open sygibson opened this issue 7 years ago • 3 comments

I'm trying to use the packet tool in a stand-alone environment where I do not want to write a profile out prior to use of the tool. It appears this is required to be able to set the DEFAULT_PROJECT_ID in the profile.

There currently exists the --key KEY option to the arguments, but there is no matching --project flag to set the Project ID. This requires setting the Profile which requires writing out a config file - which is not a desirable trait in my use case.

sygibson avatar Jul 19 '18 21:07 sygibson

well - I take it back ... :)

the --project-id flag does exist, but I had to go through the code to find it .... I would amend this Issue to be more of:

"please add documentation to command output that includes --project-id"

Thank you !

sygibson avatar Jul 19 '18 21:07 sygibson

You are right. I don't even remember why I didn't make project-id a global flag. I'll look into this and update the documentation accordingly.

ebsarr avatar Jul 21 '18 05:07 ebsarr

@sygibson . I have checked:

  • Not all commands require a project ID, that's the reason project-id is not global flag.
  • All commands that require project ID as a parameter have a project-id flag, which you can see in the help. For example:
~  packet network list-ip-reservations -h
Retrieve IP resevations for a single project

Usage:
  packet network list-ip-reservations [flags]

Flags:
  -h, --help                help for list-ip-reservations
      --project-id string   Project ID

Global Flags:
  -k, --key string       API key
  -p, --profile string   Profile name (default "default")

Maybe this option is not listed in the help of the command you wanted use? Can you let me know the command for which you had to look in the source code ?

ebsarr avatar Jul 21 '18 09:07 ebsarr