| 96 | } |
| 97 | |
| 98 | func (cli *cliLapi) newRegisterCmd() *cobra.Command { |
| 99 | var ( |
| 100 | apiURL string |
| 101 | outputFile string |
| 102 | machine string |
| 103 | token string |
| 104 | ) |
| 105 | |
| 106 | cmd := &cobra.Command{ |
| 107 | Use: "register", |
| 108 | Short: "Register a machine to Local API (LAPI)", |
| 109 | Long: `Register your machine to the Local API (LAPI). |
| 110 | Keep in mind the machine needs to be validated by an administrator on LAPI side to be effective.`, |
| 111 | Args: args.NoArgs, |
| 112 | DisableAutoGenTag: true, |
| 113 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 114 | return cli.register(cmd.Context(), apiURL, outputFile, machine, token) |
| 115 | }, |
| 116 | } |
| 117 | |
| 118 | flags := cmd.Flags() |
| 119 | flags.StringVarP(&apiURL, "url", "u", "", "URL of the API (ie. http://127.0.0.1)") |
| 120 | flags.StringVarP(&outputFile, "file", "f", "", "output file destination") |
| 121 | flags.StringVar(&machine, "machine", "", "Name of the machine to register with") |
| 122 | flags.StringVar(&token, "token", "", "Auto registration token to use") |
| 123 | |
| 124 | return cmd |
| 125 | } |