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

pack subcommands #93

Merged
merged 12 commits into from
Sep 9, 2020
Merged

pack subcommands #93

merged 12 commits into from
Sep 9, 2020

Conversation

jromero
Copy link
Member

@jromero jromero commented Jul 8, 2020

@jromero jromero marked this pull request as ready for review July 8, 2020 20:58
@jromero jromero requested a review from a team as a code owner July 8, 2020 20:58
text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
[alternatives]: #alternatives

- Keep it as it is.
- Some [Config](#config) subcommands could be more intertwined with their respective resource. For example, `pack builder trust ...` instead of `pack config trust-builder ...`.
Copy link
Member

@hone hone Jul 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative is that pack config could be a command where the first argument is the resource ala pack config:set <resource>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might get tricker b/c some of the config options have context specific usage. Example: setting a run-image-mirror requires and extra arg because you need to know what run-image you are mirroring.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made my best attempt at trying to prototype what this could look like here. Wasn't able to come up with a favorable format IMO.

@hone
Copy link
Member

hone commented Jul 15, 2020

I do agree with the motivations behind this RFC. Probably due to using the Heroku CLI, I have a preference for not using space and it's clearer to me.

text/0000-pack-subcommands.md Show resolved Hide resolved
There would also be some alias subcommands for the `app` set of subcommands for easier usage and compatibility.

* `pack build` -> `pack app build`
* `pack inspect` -> `pack app inspect`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the pack build and pack rebase aliases but I think having a pack inspect that can't inspect builders would be confusing. I instead of making it smarter (which might fall apart if someday we can inspect things that aren't images) I think we should just remove this alias.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on some discussions I think we want to move to where pack inspect can auto-detect the image resource type and display the appropriate information. For example, pack inspect <builder> will display builder info, pack inspect <app-image> will display app image information, etc.

text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
text/0000-pack-subcommands.md Show resolved Hide resolved
text/0000-pack-subcommands.md Show resolved Hide resolved
[alternatives]: #alternatives

- Keep it as it is.
- Some [Config](#config) subcommands could be more intertwined with their respective resource. For example, `pack builder trust ...` instead of `pack config trust-builder ...`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might get tricker b/c some of the config options have context specific usage. Example: setting a run-image-mirror requires and extra arg because you need to know what run-image you are mirroring.

text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
completion
config
default-builder
set
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so for this one, the command would be pack config default-builder set <value>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we consider pack config default-builder=<value>?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a proposed similar solution to unsetting? Alternative to pack config default-builder unset.

Maybe, since it's an uncommon operation, it can simply be a flag?

# set resource
pack config default-builder=<builder-name>

# unset resource
pack config default-builder --unset

# get
pack config default-builder

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jromero is this a change you're hoping to make in the RFC?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer pack config default-builder set <value> to pack config default-builder=<builder-name>. Using the verb allow for more natural/consistent extension if we ever want to include other verbs. For example imagine a future where we want additional operations on set (in the other sense) values like pack config trusted-builders add <value>.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If other folks really don't like the verbs I will concede but even in that case I would prefer pack config default-builder <builder-name> to pack config default-builder=<builder-name>. Having an = in a positional argument bugs me for some reason.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekcasey I think that's b/c in unix tooling you usually see it on flags and not position args. Take ls for instance:

--format=WORD

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in this regard have been made to the RFC. Please re-review.

text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
text/0000-pack-subcommands.md Show resolved Hide resolved
text/0000-pack-subcommands.md Show resolved Hide resolved
text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
completion
config
default-builder
set
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct.

text/0000-pack-subcommands.md Outdated Show resolved Hide resolved
text/0000-pack-subcommands.md Show resolved Hide resolved
Signed-off-by: Javier Romero <rjavier@vmware.com>

Co-authored-by: David Freilich <dfreilich@vmware.com>
@nebhale nebhale requested a review from a team August 11, 2020 22:50
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Signed-off-by: Javier Romero <rjavier@vmware.com>
Copy link
Member

@dfreilich dfreilich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, definitely a fan. I think there was a bit of a regression with inspect, so I'd appreciate a clarification there, but 🥳

remove
list
help
inspect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently have both pack inspect-image and pack inspect-builder. What would you envision with this inspect command?


##### Singular

Singular resources would have no subcommands but accept possitional arguments and flags with an implied `get` operation and a common `--unset` flag.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Singular resources would have no subcommands but accept possitional arguments and flags with an implied `get` operation and a common `--unset` flag.
Singular resources would have no subcommands but accept positional arguments and flags with an implied `get` operation and a common `--unset` flag.

pack config default-builder --unset

# gets the default builder
pack config default-builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is none set, what should the default behavior be? Should it run pack suggest-builders?

- Only allow manual edits of config file.
- A `config` command would allow providing `help` for possible operations and argument values.
- Some [Config](#config) subcommands could be more intertwined with their respective resource. For example, `pack builder trust ...` instead of `pack config trust-builder ...`.
- Other commands are operations on the resource whereas having `config` subcommands would make it more obvious that
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this point a lot. I think it makes the UX a bit more sensible, though sometimes wordy.

@hone
Copy link
Member

hone commented Sep 2, 2020

Moving this to Final Comment Period to close on Sept. 9, 2020.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.