[Feature] cli extension node list #1157

Closed
opened 2025-12-29 02:28:36 +01:00 by adam · 1 comment
Owner

Originally created by @idefixcert on GitHub (Nov 20, 2025).

Use case

First of all, thanx for the tool.
I really like headscale.

Feature request:
for the headscale cli to query information like
headscale nodes list
I would like to see the possibility to filter nodes that are not seen for 30 days
--not-seen-since 30d
for example.

Description

see detail in how it can be implemented

Contribution

  • I can write the design doc for this feature
  • I can contribute this feature

How can it be implemented?

I could implement that if you want me todo that.

also I would refactor the flag binding in the following:

eg:

func init() {
	rootCmd.AddCommand(nodeCmd)
	nodeCmd.AddCommand(createListNodesCmd())
....
}
func createListNodesCmd() *cobra.Command {
	var user string
	var showTags bool
	var listNodesCmd = &cobra.Command{
		Use:     "list",
		Short:   "List nodes",
		Aliases: []string{"ls", "show"},
		Run: func(cmd *cobra.Command, args []string) {
			output, _ := cmd.Flags().GetString("output")
			...
		},
	}
	listNodesCmd.Flags().StringVarP(&user, "user", "u", "", "Filter by user")
	listNodesCmd.Flags().BoolVarP(&showTags, "tags", "t", false, "Show tags")

	listNodesCmd.Flags().StringP("namespace", "n", "", "User")
	listNodesNamespaceFlag := listNodesCmd.Flags().Lookup("namespace")
	listNodesNamespaceFlag.Deprecated = deprecateNamespaceMessage
	listNodesNamespaceFlag.Hidden = true
	return listNodesCmd
}

that would encapsulate the variables and flags to the commands they belong to and makes refactoring much easier.

Originally created by @idefixcert on GitHub (Nov 20, 2025). ### Use case First of all, thanx for the tool. I really like headscale. Feature request: for the headscale cli to query information like `headscale nodes list` I would like to see the possibility to filter nodes that are not seen for 30 days --not-seen-since 30d for example. ### Description see detail in how it can be implemented ### Contribution - [x] I can write the design doc for this feature - [x] I can contribute this feature ### How can it be implemented? I could implement that if you want me todo that. also I would refactor the flag binding in the following: eg: ``` func init() { rootCmd.AddCommand(nodeCmd) nodeCmd.AddCommand(createListNodesCmd()) .... } func createListNodesCmd() *cobra.Command { var user string var showTags bool var listNodesCmd = &cobra.Command{ Use: "list", Short: "List nodes", Aliases: []string{"ls", "show"}, Run: func(cmd *cobra.Command, args []string) { output, _ := cmd.Flags().GetString("output") ... }, } listNodesCmd.Flags().StringVarP(&user, "user", "u", "", "Filter by user") listNodesCmd.Flags().BoolVarP(&showTags, "tags", "t", false, "Show tags") listNodesCmd.Flags().StringP("namespace", "n", "", "User") listNodesNamespaceFlag := listNodesCmd.Flags().Lookup("namespace") listNodesNamespaceFlag.Deprecated = deprecateNamespaceMessage listNodesNamespaceFlag.Hidden = true return listNodesCmd } ``` that would encapsulate the variables and flags to the commands they belong to and makes refactoring much easier.
adam added the enhancement label 2025-12-29 02:28:36 +01:00
adam closed this issue 2025-12-29 02:28:36 +01:00
Author
Owner

@kradalby commented on GitHub (Dec 17, 2025):

Duplicate (or subset) of #1974, work scheduled for 0.30

@kradalby commented on GitHub (Dec 17, 2025): Duplicate (or subset) of #1974, work scheduled for 0.30
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1157