itemcommands.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. package main
  2. import (
  3. "fmt"
  4. "github.com/fatih/color"
  5. log "github.com/sirupsen/logrus"
  6. "github.com/spf13/cobra"
  7. "github.com/crowdsecurity/go-cs-lib/coalesce"
  8. "github.com/crowdsecurity/crowdsec/cmd/crowdsec-cli/require"
  9. "github.com/crowdsecurity/crowdsec/pkg/cwhub"
  10. )
  11. type cmdHelp struct {
  12. // Example is required, the others have a default value
  13. // generated from the item type
  14. use string
  15. short string
  16. long string
  17. example string
  18. }
  19. type hubItemType struct {
  20. name string // plural, as used in the hub index
  21. singular string
  22. oneOrMore string // parenthetical pluralizaion: "parser(s)"
  23. help cmdHelp
  24. installHelp cmdHelp
  25. removeHelp cmdHelp
  26. upgradeHelp cmdHelp
  27. inspectHelp cmdHelp
  28. listHelp cmdHelp
  29. }
  30. var hubItemTypes = map[string]hubItemType{
  31. "parsers": {
  32. name: "parsers",
  33. singular: "parser",
  34. oneOrMore: "parser(s)",
  35. help: cmdHelp{
  36. example: `cscli parsers list -a
  37. cscli parsers install crowdsecurity/caddy-logs crowdsecurity/sshd-logs
  38. cscli parsers inspect crowdsecurity/caddy-logs crowdsecurity/sshd-logs
  39. cscli parsers upgrade crowdsecurity/caddy-logs crowdsecurity/sshd-logs
  40. cscli parsers remove crowdsecurity/caddy-logs crowdsecurity/sshd-logs
  41. `,
  42. },
  43. installHelp: cmdHelp{
  44. example: `cscli parsers install crowdsecurity/caddy-logs crowdsecurity/sshd-logs`,
  45. },
  46. removeHelp: cmdHelp{
  47. example: `cscli parsers remove crowdsecurity/caddy-logs crowdsecurity/sshd-logs`,
  48. },
  49. upgradeHelp: cmdHelp{
  50. example: `cscli parsers upgrade crowdsecurity/caddy-logs crowdsecurity/sshd-logs`,
  51. },
  52. inspectHelp: cmdHelp{
  53. example: `cscli parsers inspect crowdsecurity/httpd-logs crowdsecurity/sshd-logs`,
  54. },
  55. listHelp: cmdHelp{
  56. example: `cscli parsers list
  57. cscli parsers list -a
  58. cscli parsers list crowdsecurity/caddy-logs crowdsecurity/sshd-logs
  59. List only enabled parsers unless "-a" or names are specified.`,
  60. },
  61. },
  62. "postoverflows": {
  63. name: "postoverflows",
  64. singular: "postoverflow",
  65. oneOrMore: "postoverflow(s)",
  66. help: cmdHelp{
  67. example: `cscli postoverflows list -a
  68. cscli postoverflows install crowdsecurity/cdn-whitelist crowdsecurity/rdns
  69. cscli postoverflows inspect crowdsecurity/cdn-whitelist crowdsecurity/rdns
  70. cscli postoverflows upgrade crowdsecurity/cdn-whitelist crowdsecurity/rdns
  71. cscli postoverflows remove crowdsecurity/cdn-whitelist crowdsecurity/rdns
  72. `,
  73. },
  74. installHelp: cmdHelp{
  75. example: `cscli postoverflows install crowdsecurity/cdn-whitelist crowdsecurity/rdns`,
  76. },
  77. removeHelp: cmdHelp{
  78. example: `cscli postoverflows remove crowdsecurity/cdn-whitelist crowdsecurity/rdns`,
  79. },
  80. upgradeHelp: cmdHelp{
  81. example: `cscli postoverflows upgrade crowdsecurity/cdn-whitelist crowdsecurity/rdns`,
  82. },
  83. inspectHelp: cmdHelp{
  84. example: `cscli postoverflows inspect crowdsecurity/cdn-whitelist crowdsecurity/rdns`,
  85. },
  86. listHelp: cmdHelp{
  87. example: `cscli postoverflows list
  88. cscli postoverflows list -a
  89. cscli postoverflows list crowdsecurity/cdn-whitelist crowdsecurity/rdns
  90. List only enabled postoverflows unless "-a" or names are specified.`,
  91. },
  92. },
  93. "scenarios": {
  94. name: "scenarios",
  95. singular: "scenario",
  96. oneOrMore: "scenario(s)",
  97. help: cmdHelp{
  98. example: `cscli scenarios list -a
  99. cscli scenarios install crowdsecurity/ssh-bf crowdsecurity/http-probing
  100. cscli scenarios inspect crowdsecurity/ssh-bf crowdsecurity/http-probing
  101. cscli scenarios upgrade crowdsecurity/ssh-bf crowdsecurity/http-probing
  102. cscli scenarios remove crowdsecurity/ssh-bf crowdsecurity/http-probing
  103. `,
  104. },
  105. installHelp: cmdHelp{
  106. example: `cscli scenarios install crowdsecurity/ssh-bf crowdsecurity/http-probing`,
  107. },
  108. removeHelp: cmdHelp{
  109. example: `cscli scenarios remove crowdsecurity/ssh-bf crowdsecurity/http-probing`,
  110. },
  111. upgradeHelp: cmdHelp{
  112. example: `cscli scenarios upgrade crowdsecurity/ssh-bf crowdsecurity/http-probing`,
  113. },
  114. inspectHelp: cmdHelp{
  115. example: `cscli scenarios inspect crowdsecurity/ssh-bf crowdsecurity/http-probing`,
  116. },
  117. listHelp: cmdHelp{
  118. example: `cscli scenarios list
  119. cscli scenarios list -a
  120. cscli scenarios list crowdsecurity/ssh-bf crowdsecurity/http-probing
  121. List only enabled scenarios unless "-a" or names are specified.`,
  122. },
  123. },
  124. "waap-rules": {
  125. name: "waap-rules",
  126. singular: "waap-rule",
  127. oneOrMore: "waap-rule(s)",
  128. help: cmdHelp{
  129. example: `cscli waap-rules list -a
  130. cscli waap-rules install crowdsecurity/crs
  131. cscli waap-rules inspect crowdsecurity/crs
  132. cscli waap-rules upgrade crowdsecurity/crs
  133. cscli waap-rules remove crowdsecurity/crs
  134. `,
  135. },
  136. installHelp: cmdHelp{
  137. example: `cscli waap-rules install crowdsecurity/crs`,
  138. },
  139. removeHelp: cmdHelp{
  140. example: `cscli waap-rules remove crowdsecurity/crs`,
  141. },
  142. upgradeHelp: cmdHelp{
  143. example: `cscli waap-rules upgrade crowdsecurity/crs`,
  144. },
  145. inspectHelp: cmdHelp{
  146. example: `cscli waap-rules inspect crowdsecurity/crs`,
  147. },
  148. listHelp: cmdHelp{
  149. example: `cscli waap-rules list
  150. cscli waap-rules list -a
  151. cscli waap-rules list crowdsecurity/crs`,
  152. },
  153. },
  154. "waap-configs": {
  155. name: "waap-configs",
  156. singular: "waap-config",
  157. oneOrMore: "waap-config(s)",
  158. help: cmdHelp{
  159. example: `cscli waap-configs list -a
  160. cscli waap-configs install crowdsecurity/vpatch
  161. cscli waap-configs inspect crowdsecurity/vpatch
  162. cscli waap-configs upgrade crowdsecurity/vpatch
  163. cscli waap-configs remove crowdsecurity/vpatch
  164. `,
  165. },
  166. installHelp: cmdHelp{
  167. example: `cscli waap-configs install crowdsecurity/vpatch`,
  168. },
  169. removeHelp: cmdHelp{
  170. example: `cscli waap-configs remove crowdsecurity/vpatch`,
  171. },
  172. upgradeHelp: cmdHelp{
  173. example: `cscli waap-configs upgrade crowdsecurity/vpatch`,
  174. },
  175. inspectHelp: cmdHelp{
  176. example: `cscli waap-configs inspect crowdsecurity/vpatch`,
  177. },
  178. listHelp: cmdHelp{
  179. example: `cscli waap-configs list
  180. cscli waap-configs list -a
  181. cscli waap-configs list crowdsecurity/vpatch`,
  182. },
  183. },
  184. "collections": {
  185. name: "collections",
  186. singular: "collection",
  187. oneOrMore: "collection(s)",
  188. help: cmdHelp{
  189. example: `cscli collections list -a
  190. cscli collections install crowdsecurity/http-cve crowdsecurity/iptables
  191. cscli collections inspect crowdsecurity/http-cve crowdsecurity/iptables
  192. cscli collections upgrade crowdsecurity/http-cve crowdsecurity/iptables
  193. cscli collections remove crowdsecurity/http-cve crowdsecurity/iptables
  194. `,
  195. },
  196. installHelp: cmdHelp{
  197. example: `cscli collections install crowdsecurity/http-cve crowdsecurity/iptables`,
  198. },
  199. removeHelp: cmdHelp{
  200. example: `cscli collections remove crowdsecurity/http-cve crowdsecurity/iptables`,
  201. },
  202. upgradeHelp: cmdHelp{
  203. example: `cscli collections upgrade crowdsecurity/http-cve crowdsecurity/iptables`,
  204. },
  205. inspectHelp: cmdHelp{
  206. example: `cscli collections inspect crowdsecurity/http-cve crowdsecurity/iptables`,
  207. },
  208. listHelp: cmdHelp{
  209. example: `cscli collections list
  210. cscli collections list -a
  211. cscli collections list crowdsecurity/http-cve crowdsecurity/iptables
  212. List only enabled collections unless "-a" or names are specified.`,
  213. },
  214. },
  215. }
  216. func NewItemsCmd(typeName string) *cobra.Command {
  217. it := hubItemTypes[typeName]
  218. cmd := &cobra.Command{
  219. Use: coalesce.String(it.help.use, fmt.Sprintf("%s <action> [item]...", it.name)),
  220. Short: coalesce.String(it.help.short, fmt.Sprintf("Manage hub %s", it.name)),
  221. Long: it.help.long,
  222. Example: it.help.example,
  223. Args: cobra.MinimumNArgs(1),
  224. Aliases: []string{it.singular},
  225. DisableAutoGenTag: true,
  226. }
  227. cmd.AddCommand(NewItemsInstallCmd(typeName))
  228. cmd.AddCommand(NewItemsRemoveCmd(typeName))
  229. cmd.AddCommand(NewItemsUpgradeCmd(typeName))
  230. cmd.AddCommand(NewItemsInspectCmd(typeName))
  231. cmd.AddCommand(NewItemsListCmd(typeName))
  232. return cmd
  233. }
  234. func itemsInstallRunner(it hubItemType) func(cmd *cobra.Command, args []string) error {
  235. run := func(cmd *cobra.Command, args []string) error {
  236. flags := cmd.Flags()
  237. downloadOnly, err := flags.GetBool("download-only")
  238. if err != nil {
  239. return err
  240. }
  241. force, err := flags.GetBool("force")
  242. if err != nil {
  243. return err
  244. }
  245. ignoreError, err := flags.GetBool("ignore")
  246. if err != nil {
  247. return err
  248. }
  249. hub, err := require.Hub(csConfig, require.RemoteHub(csConfig))
  250. if err != nil {
  251. return err
  252. }
  253. for _, name := range args {
  254. item := hub.GetItem(it.name, name)
  255. if item == nil {
  256. msg := SuggestNearestMessage(hub, it.name, name)
  257. if !ignoreError {
  258. return fmt.Errorf(msg)
  259. }
  260. log.Errorf(msg)
  261. continue
  262. }
  263. if err := item.Install(force, downloadOnly); err != nil {
  264. if !ignoreError {
  265. return fmt.Errorf("error while installing '%s': %w", item.Name, err)
  266. }
  267. log.Errorf("Error while installing '%s': %s", item.Name, err)
  268. }
  269. }
  270. log.Infof(ReloadMessage())
  271. return nil
  272. }
  273. return run
  274. }
  275. func NewItemsInstallCmd(typeName string) *cobra.Command {
  276. it := hubItemTypes[typeName]
  277. cmd := &cobra.Command{
  278. Use: coalesce.String(it.installHelp.use, "install [item]..."),
  279. Short: coalesce.String(it.installHelp.short, fmt.Sprintf("Install given %s", it.oneOrMore)),
  280. Long: coalesce.String(it.installHelp.long, fmt.Sprintf("Fetch and install one or more %s from the hub", it.name)),
  281. Example: it.installHelp.example,
  282. Args: cobra.MinimumNArgs(1),
  283. DisableAutoGenTag: true,
  284. ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
  285. return compAllItems(typeName, args, toComplete)
  286. },
  287. RunE: itemsInstallRunner(it),
  288. }
  289. flags := cmd.Flags()
  290. flags.BoolP("download-only", "d", false, "Only download packages, don't enable")
  291. flags.Bool("force", false, "Force install: overwrite tainted and outdated files")
  292. flags.Bool("ignore", false, fmt.Sprintf("Ignore errors when installing multiple %s", it.name))
  293. return cmd
  294. }
  295. // return the names of the installed parents of an item, used to check if we can remove it
  296. func istalledParentNames(item *cwhub.Item) []string {
  297. ret := make([]string, 0)
  298. for _, parent := range item.Ancestors() {
  299. if parent.State.Installed {
  300. ret = append(ret, parent.Name)
  301. }
  302. }
  303. return ret
  304. }
  305. func itemsRemoveRunner(it hubItemType) func(cmd *cobra.Command, args []string) error {
  306. run := func(cmd *cobra.Command, args []string) error {
  307. flags := cmd.Flags()
  308. purge, err := flags.GetBool("purge")
  309. if err != nil {
  310. return err
  311. }
  312. force, err := flags.GetBool("force")
  313. if err != nil {
  314. return err
  315. }
  316. all, err := flags.GetBool("all")
  317. if err != nil {
  318. return err
  319. }
  320. hub, err := require.Hub(csConfig, nil)
  321. if err != nil {
  322. return err
  323. }
  324. if all {
  325. getter := hub.GetInstalledItems
  326. if purge {
  327. getter = hub.GetAllItems
  328. }
  329. items, err := getter(it.name)
  330. if err != nil {
  331. return err
  332. }
  333. removed := 0
  334. for _, item := range items {
  335. didRemove, err := item.Remove(purge, force)
  336. if err != nil {
  337. return err
  338. }
  339. if didRemove {
  340. removed++
  341. }
  342. }
  343. log.Infof("Removed %d %s", removed, it.name)
  344. if removed > 0 {
  345. log.Infof(ReloadMessage())
  346. }
  347. return nil
  348. }
  349. if len(args) == 0 {
  350. return fmt.Errorf("specify at least one %s to remove or '--all'", it.singular)
  351. }
  352. removed := 0
  353. for _, itemName := range args {
  354. item := hub.GetItem(it.name, itemName)
  355. if item == nil {
  356. return fmt.Errorf("can't find '%s' in %s", itemName, it.name)
  357. }
  358. parents := istalledParentNames(item)
  359. if !force && len(parents) > 0 {
  360. log.Warningf("%s belongs to collections: %s", item.Name, parents)
  361. log.Warningf("Run 'sudo cscli %s remove %s --force' if you want to force remove this %s", item.Type, item.Name, it.singular)
  362. continue
  363. }
  364. didRemove, err := item.Remove(purge, force)
  365. if err != nil {
  366. return err
  367. }
  368. if didRemove {
  369. log.Infof("Removed %s", item.Name)
  370. removed++
  371. }
  372. }
  373. if removed > 0 {
  374. log.Infof(ReloadMessage())
  375. }
  376. return nil
  377. }
  378. return run
  379. }
  380. func NewItemsRemoveCmd(typeName string) *cobra.Command {
  381. it := hubItemTypes[typeName]
  382. cmd := &cobra.Command{
  383. Use: coalesce.String(it.removeHelp.use, "remove [item]..."),
  384. Short: coalesce.String(it.removeHelp.short, fmt.Sprintf("Remove given %s", it.oneOrMore)),
  385. Long: coalesce.String(it.removeHelp.long, fmt.Sprintf("Remove one or more %s", it.name)),
  386. Example: it.removeHelp.example,
  387. Aliases: []string{"delete"},
  388. DisableAutoGenTag: true,
  389. ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
  390. return compInstalledItems(it.name, args, toComplete)
  391. },
  392. RunE: itemsRemoveRunner(it),
  393. }
  394. flags := cmd.Flags()
  395. flags.Bool("purge", false, "Delete source file too")
  396. flags.Bool("force", false, "Force remove: remove tainted and outdated files")
  397. flags.Bool("all", false, fmt.Sprintf("Remove all the %s", it.name))
  398. return cmd
  399. }
  400. func itemsUpgradeRunner(it hubItemType) func(cmd *cobra.Command, args []string) error {
  401. run := func(cmd *cobra.Command, args []string) error {
  402. flags := cmd.Flags()
  403. force, err := flags.GetBool("force")
  404. if err != nil {
  405. return err
  406. }
  407. all, err := flags.GetBool("all")
  408. if err != nil {
  409. return err
  410. }
  411. hub, err := require.Hub(csConfig, require.RemoteHub(csConfig))
  412. if err != nil {
  413. return err
  414. }
  415. if all {
  416. items, err := hub.GetInstalledItems(it.name)
  417. if err != nil {
  418. return err
  419. }
  420. updated := 0
  421. for _, item := range items {
  422. didUpdate, err := item.Upgrade(force)
  423. if err != nil {
  424. return err
  425. }
  426. if didUpdate {
  427. updated++
  428. }
  429. }
  430. log.Infof("Updated %d %s", updated, it.name)
  431. if updated > 0 {
  432. log.Infof(ReloadMessage())
  433. }
  434. return nil
  435. }
  436. if len(args) == 0 {
  437. return fmt.Errorf("specify at least one %s to upgrade or '--all'", it.singular)
  438. }
  439. updated := 0
  440. for _, itemName := range args {
  441. item := hub.GetItem(it.name, itemName)
  442. if item == nil {
  443. return fmt.Errorf("can't find '%s' in %s", itemName, it.name)
  444. }
  445. didUpdate, err := item.Upgrade(force)
  446. if err != nil {
  447. return err
  448. }
  449. if didUpdate {
  450. log.Infof("Updated %s", item.Name)
  451. updated++
  452. }
  453. }
  454. if updated > 0 {
  455. log.Infof(ReloadMessage())
  456. }
  457. return nil
  458. }
  459. return run
  460. }
  461. func NewItemsUpgradeCmd(typeName string) *cobra.Command {
  462. it := hubItemTypes[typeName]
  463. cmd := &cobra.Command{
  464. Use: coalesce.String(it.upgradeHelp.use, "upgrade [item]..."),
  465. Short: coalesce.String(it.upgradeHelp.short, fmt.Sprintf("Upgrade given %s", it.oneOrMore)),
  466. Long: coalesce.String(it.upgradeHelp.long, fmt.Sprintf("Fetch and upgrade one or more %s from the hub", it.name)),
  467. Example: it.upgradeHelp.example,
  468. DisableAutoGenTag: true,
  469. ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
  470. return compInstalledItems(it.name, args, toComplete)
  471. },
  472. RunE: itemsUpgradeRunner(it),
  473. }
  474. flags := cmd.Flags()
  475. flags.BoolP("all", "a", false, fmt.Sprintf("Upgrade all the %s", it.name))
  476. flags.Bool("force", false, "Force upgrade: overwrite tainted and outdated files")
  477. return cmd
  478. }
  479. func itemsInspectRunner(it hubItemType) func(cmd *cobra.Command, args []string) error {
  480. run := func(cmd *cobra.Command, args []string) error {
  481. flags := cmd.Flags()
  482. url, err := flags.GetString("url")
  483. if err != nil {
  484. return err
  485. }
  486. if url != "" {
  487. csConfig.Cscli.PrometheusUrl = url
  488. }
  489. noMetrics, err := flags.GetBool("no-metrics")
  490. if err != nil {
  491. return err
  492. }
  493. hub, err := require.Hub(csConfig, nil)
  494. if err != nil {
  495. return err
  496. }
  497. for _, name := range args {
  498. item := hub.GetItem(it.name, name)
  499. if item == nil {
  500. return fmt.Errorf("can't find '%s' in %s", name, it.name)
  501. }
  502. if err = InspectItem(item, !noMetrics); err != nil {
  503. return err
  504. }
  505. }
  506. return nil
  507. }
  508. return run
  509. }
  510. func NewItemsInspectCmd(typeName string) *cobra.Command {
  511. it := hubItemTypes[typeName]
  512. cmd := &cobra.Command{
  513. Use: coalesce.String(it.inspectHelp.use, "inspect [item]..."),
  514. Short: coalesce.String(it.inspectHelp.short, fmt.Sprintf("Inspect given %s", it.oneOrMore)),
  515. Long: coalesce.String(it.inspectHelp.long, fmt.Sprintf("Inspect the state of one or more %s", it.name)),
  516. Example: it.inspectHelp.example,
  517. Args: cobra.MinimumNArgs(1),
  518. DisableAutoGenTag: true,
  519. ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
  520. return compInstalledItems(it.name, args, toComplete)
  521. },
  522. RunE: itemsInspectRunner(it),
  523. }
  524. flags := cmd.Flags()
  525. flags.StringP("url", "u", "", "Prometheus url")
  526. flags.Bool("no-metrics", false, "Don't show metrics (when cscli.output=human)")
  527. return cmd
  528. }
  529. func itemsListRunner(it hubItemType) func(cmd *cobra.Command, args []string) error {
  530. run := func(cmd *cobra.Command, args []string) error {
  531. flags := cmd.Flags()
  532. all, err := flags.GetBool("all")
  533. if err != nil {
  534. return err
  535. }
  536. hub, err := require.Hub(csConfig, nil)
  537. if err != nil {
  538. return err
  539. }
  540. items := make(map[string][]*cwhub.Item)
  541. items[it.name], err = selectItems(hub, it.name, args, !all)
  542. if err != nil {
  543. return err
  544. }
  545. if err = listItems(color.Output, []string{it.name}, items); err != nil {
  546. return err
  547. }
  548. return nil
  549. }
  550. return run
  551. }
  552. func NewItemsListCmd(typeName string) *cobra.Command {
  553. it := hubItemTypes[typeName]
  554. cmd := &cobra.Command{
  555. Use: coalesce.String(it.listHelp.use, "list [item... | -a]"),
  556. Short: coalesce.String(it.listHelp.short, fmt.Sprintf("List %s", it.oneOrMore)),
  557. Long: coalesce.String(it.listHelp.long, fmt.Sprintf("List of installed/available/specified %s", it.name)),
  558. Example: it.listHelp.example,
  559. DisableAutoGenTag: true,
  560. RunE: itemsListRunner(it),
  561. }
  562. flags := cmd.Flags()
  563. flags.BoolP("all", "a", false, "List disabled items as well")
  564. return cmd
  565. }