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

chore: refactor the cli command structure #961

Merged
merged 2 commits into from
Jul 14, 2023
Merged

chore: refactor the cli command structure #961

merged 2 commits into from
Jul 14, 2023

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Jul 13, 2023

desired structure:

- version     Print the decK version
- completion  Generate completion script
- help        Help about any command
​
- file        decK file operations
  - add-tags     Adds tags to objects in a decK file
  - list-tags    Lists current tags to objects in a decK file
  - merge        Merges multiple decK files into one
  - openapi2kong Convert OpenAPI files to Kong's decK format
  - patch        Applies patches on top of a decK file
  - remove-tags  Removes tags from objects in a decK file
  - convert      Convert files from one format into another format
  - render       renders a final decK file as it would be synced (for local diffs)
  - validate     ==> alias for usability, since it does both file+online
- kong        online operations
  - diff         Diff the current entities in Kong with the one on disks
  - dump         Export Kong configuration to a file
  - ping         Verify connectivity with Kong
  - reset        Reset deletes all entities in Kong
  - sync         Sync performs operations to get Kong's configuration to match the state file
  - validate     Validate the state file
- diff        ==> alias for backward compatibilty
- dump        ==> alias for backward compatibilty
- ping        ==> alias for backward compatibilty
- reset       ==> alias for backward compatibilty
- sync        ==> alias for backward compatibilty
- validate    ==> alias for backward compatibilty
- convert     ==> alias for backward compatibilty

Todo:

@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.07 ⚠️

Comparison is base (a9a77fe) 34.12% compared to head (ca22ea9) 34.05%.

Additional details and impacted files
@@               Coverage Diff               @@
##           feat/apiops     #961      +/-   ##
===============================================
- Coverage        34.12%   34.05%   -0.07%     
===============================================
  Files               99      100       +1     
  Lines            11855    11879      +24     
===============================================
  Hits              4045     4045              
- Misses            7417     7441      +24     
  Partials           393      393              
Impacted Files Coverage Δ
cmd/convert.go 0.00% <0.00%> (ø)
cmd/file.go 0.00% <0.00%> (ø)
cmd/root.go 0.91% <0.00%> (-0.02%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

cmd/convert.go Outdated Show resolved Hide resolved
@rspurgeon
Copy link
Collaborator

I accidentally ran the following:

deck file diff -s PRD/kong/kong.yaml --konnect-runtime-group-name ...

And received this error:

Error: unknown shorthand flag: 's' in -s

I think the error should indicate that the subcommand (diff) is invalid for the parent (file).

cmd/kong.go Outdated Show resolved Hide resolved
@Tieske Tieske force-pushed the subcommand branch 3 times, most recently from 339140e to ca22ea9 Compare July 14, 2023 10:58
@Tieske Tieske marked this pull request as ready for review July 14, 2023 11:06
@Tieske Tieske requested a review from a team July 14, 2023 11:06
@Tieske
Copy link
Member Author

Tieske commented Jul 14, 2023

I think the error should indicate that the subcommand (diff) is invalid for the parent (file).

I did a quick check, but this is how Cobra handles the CLI args, seems our client code has no control on this.

@Tieske Tieske merged commit 0e0827a into feat/apiops Jul 14, 2023
31 checks passed
@Tieske Tieske deleted the subcommand branch July 14, 2023 11:10
@Tieske
Copy link
Member Author

Tieske commented Jul 14, 2023

fyi, merged in the ApiOps branch, not to main yet.

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.

None yet

4 participants