[PR #2636] Standardize user identification flags across CLI commands - fix for #2631 #2773

Open
opened 2025-12-29 04:18:55 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2636
Author: @tevinflores
Created: 5/29/2025
Status: 🔄 Open

Base: mainHead: fix-cli-user-args


📝 Commits (3)

  • a32b156 This commit adds the "findSingleUser" helper function that centralizes and standardizes user lookup operations across CLI commands. The function:
  • 78d89df Improve clarity and consistency of error messages by using descriptive
  • e54bb97 This change standardizes the command line flag naming conventions across the headscale CLI:

📊 Changes

10 files changed (+227 additions, -220 deletions)

View changed files

📝 cmd/headscale/cli/debug.go (+8 -13)
📝 cmd/headscale/cli/nodes.go (+53 -74)
📝 cmd/headscale/cli/preauthkeys.go (+28 -24)
cmd/headscale/cli/user_helpers.go (+84 -0)
📝 cmd/headscale/cli/users.go (+8 -71)
📝 integration/auth_key_test.go (+1 -1)
📝 integration/cli_test.go (+28 -30)
📝 integration/general_test.go (+3 -3)
📝 integration/hsic/hsic.go (+12 -2)
📝 integration/scenario.go (+2 -2)

📄 Description

This PR replaces inconsistent -u/--user arguments with the standard --identifier/--name flags for user identification. Previously, some commands used --user to accept either a user ID (uint) or username (string), creating confusion and inconsistent behavior. This change provides a more explicit and predictable interface for specifying users throughout the CLI.

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if #needed
  • updated CHANGELOG.md

Issue ref: #2631


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2636 **Author:** [@tevinflores](https://github.com/tevinflores) **Created:** 5/29/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-cli-user-args` --- ### 📝 Commits (3) - [`a32b156`](https://github.com/juanfont/headscale/commit/a32b156d25777b30aba027030ff28377e6718483) This commit adds the "findSingleUser" helper function that centralizes and standardizes user lookup operations across CLI commands. The function: - [`78d89df`](https://github.com/juanfont/headscale/commit/78d89dff6b65fccec1a663390cd0f5a06694e129) Improve clarity and consistency of error messages by using descriptive - [`e54bb97`](https://github.com/juanfont/headscale/commit/e54bb9763c5edfe8a9abe87d60940dfe9bf54de0) This change standardizes the command line flag naming conventions across the headscale CLI: ### 📊 Changes **10 files changed** (+227 additions, -220 deletions) <details> <summary>View changed files</summary> 📝 `cmd/headscale/cli/debug.go` (+8 -13) 📝 `cmd/headscale/cli/nodes.go` (+53 -74) 📝 `cmd/headscale/cli/preauthkeys.go` (+28 -24) ➕ `cmd/headscale/cli/user_helpers.go` (+84 -0) 📝 `cmd/headscale/cli/users.go` (+8 -71) 📝 `integration/auth_key_test.go` (+1 -1) 📝 `integration/cli_test.go` (+28 -30) 📝 `integration/general_test.go` (+3 -3) 📝 `integration/hsic/hsic.go` (+12 -2) 📝 `integration/scenario.go` (+2 -2) </details> ### 📄 Description This PR replaces inconsistent -u/--user arguments with the standard --identifier/--name flags for user identification. Previously, some commands used --user to accept either a user ID (uint) or username (string), creating confusion and inconsistent behavior. This change provides a more explicit and predictable interface for specifying users throughout the CLI. - [x] have read the [CONTRIBUTING.md](./CONTRIBUTING.md) file - [x] raised a GitHub issue or discussed it on the projects chat beforehand - [x] added unit tests - [x] added integration tests - [ ] updated documentation if #needed - [ ] updated CHANGELOG.md Issue ref: #2631 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 04:18:55 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2773