Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Migrate to cobra#86

Merged
cmoog merged 10 commits intomasterfromurfave
Aug 10, 2020
Merged

Migrate to cobra#86

cmoog merged 10 commits intomasterfromurfave
Aug 10, 2020

Conversation

cmoog
Copy link
Contributor

@cmoogcmoog commentedJul 31, 2020
edited
Loading

I plan on following this up immediately with a cleanup of the error handling across the CLI layer. I'd prefer to merge as soon as posable to prevent blocking additional work. We should move away from callingflog.Fatal and towards the built-in error handling present in theurfave/cli. Done.

As noted by@nhooyr, the closure pattern is non-obvious. Let me know what you think.

This PR also includes many improvements/additions, most notably to theenvs andurls subcommands.urls was kept at the top level to prevent unnecessary coupling, but I'm thinking we should move it to a subcommand ofenvs.

coder provides a CLI for working with an existing Coder Enterprise installationUsage:  coder [command]Available Commands:  completion  Generate completion script  config-ssh  Configure SSH to access Coder environments  envs        Interact with Coder environments  help        Help about any command  login       Authenticate this client for future operations  logout      Remove local authentication credentials if any exist  secrets     Interact with Coder Secrets  sh          Open a shell and execute commands in a Coder environment  sync        Establish a one way directory sync to a Coder environment  urls        Interact with environment DevURLs  users       Interact with Coder user accountsFlags:  -h, --help      help for coder  -v, --version   version for coderUse "coder [command] --help" for more information about a command.

Closes#85
cc@nhooyr@anthonyshull@coadler

Closes#82

}
}

type listSecretsCmd struct{}
func makeCreateSecret() cli.Command {
Copy link
Contributor

Choose a reason for hiding this comment

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

Idk how I feel about this.

@cmoogcmoogforce-pushed theurfave branch 2 times, most recently fromb9cb39d to316033eCompareAugust 4, 2020 16:07
@cmoogcmoog mentioned this pull requestAug 4, 2020
@cmoogcmoog marked this pull request as ready for reviewAugust 4, 2020 16:50
@nhooyr
Copy link
Contributor

Do you prefer v2 or v1 urfave@cmoog?

@coadler
Copy link
Contributor

From looking that the migration docs it just seems like they made envs accept a slice and made most of the command/flag structs pointers instead.

nhooyr reacted with thumbs up emoji

@cmoog
Copy link
ContributorAuthor

It looks like they enforce that flags are positioned before arguments too. Definetly not a fan of that. For example, the following is invalid.

coder secrets create newsecret --from-literal 123

In v2, this must be

coder secrets create --from-literal 123 newsecret

@nhooyr
Copy link
Contributor

Yea that straight sucks :(

@cmoog
Copy link
ContributorAuthor

cmoog commentedAug 6, 2020
edited
Loading

Yeah for sure, going to revert the migration cause that's super annoying.

@nhooyr
Copy link
Contributor

I’d be in favour of using cobra then.

cmoog reacted with heart emoji

@cmoog
Copy link
ContributorAuthor

Nevermind, I think the flag-before-arg is fine given that thehelp template accurately reflects that and we'll show plenty of example usages in the documentation.

@cmoogcmoog requested a review fromcoadlerAugust 6, 2020 18:52
@nhooyr
Copy link
Contributor

From a UX perspective it's super annoying imo when I'm editing a CLI command. Any context on why they made this change?

@coadler
Copy link
Contributor

@nhooyrhttps://github.com/urfave/cli/blob/master/docs/migrate-v1-to-v2.md#flags-before-args

In v2 flags must come before args. This is more POSIX-compliant.

cmoog reacted with thumbs up emoji

@nhooyr
Copy link
Contributor

That’s so dumb. What does it have to do with POSIX lol.

@nhooyr
Copy link
Contributor

urfave/cli#1113

@cmoog
Copy link
ContributorAuthor

@nhooyr@coadler how do you cast your votes?

@nhooyr
Copy link
Contributor

If you're ok migrating, I'd say we go for cobra instead for UX. But I defer to you.

@cmoogcmoog changed the titleMigrate to urfave/cliMigrate to cobraAug 7, 2020
@cmoogcmoog removed the request for review fromscsmithrAugust 7, 2020 17:30
@cmoog
Copy link
ContributorAuthor

There are some error handling inconsistencies but nothing too bad that can't be fixed after this merges. Don't want to keep this unmerged much longer as it's blocking feature work.

Copy link
Contributor

@nhooyrnhooyr left a comment

Choose a reason for hiding this comment

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

how's the fish completion now?

@@ -0,0 +1,26 @@
# ci
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be good to link to this from the README.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Most readers of theREADME will be customers, not developers. Doesn't really make sense to bring attention to it in my view.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't have to bring attention to it. Just put a link at the bottom. Customers/potential customers who care to look closely will be happy we document and care about these things.

@cmoogcmoog requested a review fromnhooyrAugust 10, 2020 14:36
@nhooyr
Copy link
Contributor

I'm a little swamped right now, don't think I can give this a good review sorry!

cmoog reacted with thumbs up emoji

@cmoogcmoog removed the request for review fromnhooyrAugust 10, 2020 18:39
@cmoog
Copy link
ContributorAuthor

To unblock feature work and prevent a rush before the release date, I'm going to merge this now. Some cleanup PRs will be following in parallel.

@cmoogcmoog merged commit56a76c4 intomasterAug 10, 2020
@cmoogcmoog deleted the urfave branchAugust 10, 2020 21:42
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@nhooyrnhooyrnhooyr left review comments

@coadlercoadlerAwaiting requested review from coadler

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Migrate to urfave/cli Running 'coder urls' without any arguments errors
3 participants
@cmoog@nhooyr@coadler

[8]ページ先頭

©2009-2025 Movatter.jp