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

CLI improvements proposal: subcommands #71

Merged
merged 17 commits into from
May 1, 2023

Conversation

happyRip
Copy link
Member

@happyRip happyRip commented Apr 17, 2023

Summary

Ref #56
#65 (comment)

This PR features changes from #70

Changes

  • Add ttnv3 command with device and application subcommands
  • source.FlagSet takes an argument to return the flags for the specified source
    • To get flags for all registered sources source.AllFlagSets is used. It prepends each flag name with a source names, so each flag is unique (replicating legacy behaviour)

Testing

Use ttnv3 command to export devices instead of relying on the --source flag:

go run cmd/ttn-lw-migrate/main.go ttnv3 devices --help
Regressions

...

Notes for Reviewers

ttnv2 and chirpstack commands have been skipped for the initial iteration since they should be twin to ttnv3 anyway.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Documentation: Relevant documentation is added or updated.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.

@happyRip happyRip self-assigned this Apr 17, 2023
@happyRip happyRip added this to the 2023 Q2 milestone Apr 17, 2023
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch 2 times, most recently from 8301840 to 325f64c Compare April 18, 2023 15:02
@happyRip happyRip marked this pull request as ready for review April 18, 2023 15:09
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch from 325f64c to 03d4d18 Compare April 18, 2023 15:09
Copy link
Contributor

@adriansmares adriansmares left a comment

Choose a reason for hiding this comment

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

Great start.

cmd/ttnv3/application.go Outdated Show resolved Hide resolved
cmd/ttnv3/devices.go Outdated Show resolved Hide resolved
cmd/ttnv3/ttnv3.go Outdated Show resolved Hide resolved
cmd/util.go Outdated Show resolved Hide resolved
Base automatically changed from feature/improve-config to master April 24, 2023 13:36
@happyRip happyRip requested a review from adriansmares April 25, 2023 09:41
cmd/ttnv3/ttnv3.go Outdated Show resolved Hide resolved
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch 4 times, most recently from 0f4f518 to 5b47c48 Compare April 25, 2023 15:18
Copy link
Member

@johanstokking johanstokking left a comment

Choose a reason for hiding this comment

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

This definitely goes in the right direction, thanks

cmd/root.go Outdated Show resolved Hide resolved
cmd/ttn-lw-migrate/main.go Outdated Show resolved Hide resolved
cmd/ttnv3/ttnv3.go Outdated Show resolved Hide resolved
pkg/commands/commands.go Outdated Show resolved Hide resolved
pkg/commands/iterator.go Outdated Show resolved Hide resolved
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch from 54e2b3e to 57cb05d Compare April 26, 2023 11:25
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch from 57cb05d to d1d4bba Compare April 26, 2023 11:56
@happyRip happyRip mentioned this pull request Apr 26, 2023
@happyRip happyRip requested a review from johanstokking April 26, 2023 14:15
cmd/root.go Outdated Show resolved Hide resolved
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch from d1d4bba to cf58f86 Compare April 28, 2023 06:22
Apply the changes when `spf13/cobra` package is upgraded in `go.mod`.
Command used:

```bash
$ find . -name "*.go" -type f -exec sed -i '' 's/© 202./© 2023/g' {} \;
```
@happyRip happyRip force-pushed the feature/56-cli-improvement-subcommands branch from cf58f86 to 738fe88 Compare April 28, 2023 06:31
@happyRip happyRip requested a review from johanstokking April 28, 2023 06:51
@happyRip happyRip merged commit ca5cb4d into master May 1, 2023
@happyRip happyRip deleted the feature/56-cli-improvement-subcommands branch May 1, 2023 06:48
@happyRip happyRip linked an issue May 1, 2023 that may be closed by this pull request
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.

Migration tool CLI redesign
3 participants