[client] Move global flags to the commands that actually use them

Merged
TH
16d ago
+56-19

Describe your changes

This PR moves global CLI flags to the commands that actually use them.

  • --setup-key, --setup-key-file, --preshared-key, --hostname, -m flags moved to up and login commands.
  • --anonymize-level flag moved to status and debug commands.
  • --service flag moved to service command.

Issue ticket number and link

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • I ran and tested this change locally — I did not rely on CI to find out whether it works
  • This PR has a single purpose (not a fix + refactor + feature in one)
  • This change is a trivial fix, OR it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/1098

Summary by CodeRabbit

  • New Features

    • Management URL options are available on relevant service commands.
    • When switching to a profile that does not exist, the app can create it and retry the switch.
  • Bug Fixes

    • Commands now apply environment-based settings more consistently, including anonymization options.
    • Daemon mode resolves the active profile when the local profile information is not authoritative, with clearer errors when an explicit profile is needed.
    • Pre-shared-key overrides are recognized when set on the command being run.