diff --git a/cmd/cycles.go b/cmd/cycles.go index 37b90b9..296282b 100644 --- a/cmd/cycles.go +++ b/cmd/cycles.go @@ -30,12 +30,8 @@ var cyclesCmd = &cobra.Command{ Use: "cycles", Short: "Prints cycles in dependency chains.", Long: `Will show all the cycles in the dependencies of the project.`, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { - - if len(args) != 0 { - return fmt.Errorf("cycles does not take any arguments") - } - overview := getDepInfo(nil) var cycleChains []Chain var temp Chain diff --git a/cmd/list.go b/cmd/list.go index b1001a8..40a06d7 100644 --- a/cmd/list.go +++ b/cmd/list.go @@ -28,12 +28,8 @@ var listCmd = &cobra.Command{ Short: "Lists all project dependencies", Long: `Gives a list of all the dependencies of the project. These include both direct as well as transitive dependencies.`, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { - - if len(args) != 0 { - return fmt.Errorf("list does not take any arguments") - } - depGraph := getDepInfo(nil) fmt.Println("List of all dependencies:") allDeps := getAllDeps(depGraph.DirectDepList, depGraph.TransDepList) diff --git a/cmd/stats.go b/cmd/stats.go index a627716..e7e1d2b 100644 --- a/cmd/stats.go +++ b/cmd/stats.go @@ -40,13 +40,10 @@ var statsCmd = &cobra.Command{ 2. Transitive Dependencies: Total number of transitive dependencies (dependencies which are further needed by direct dependencies of the project) 3. Total Dependencies: Total number of dependencies of the mainModule(s) 4. Max Depth of Dependencies: Length of the longest chain starting from the first mainModule; defaults to length from the first module encountered in "go mod graph" output`, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { depGraph := getDepInfo(mainModules) - if len(args) != 0 { - return fmt.Errorf("stats does not take any arguments") - } - // get the longest chain var temp Chain longestChain := getLongestChain(depGraph.MainModules[0], depGraph.Graph, temp, map[string]Chain{})