@@ -110,6 +110,7 @@ Below are examples of setting the environment variables in Linux/MacOS to be use
110
110
111
111
This is the minimum required configuration to authenticate to Keyfactor Command using Active Directory username,
112
112
password auth.
113
+
113
114
` ` ` bash
114
115
export KEYFACTOR_HOSTNAME=" <mykeyfactorhost.mydomain.com>"
115
116
export KEYFACTOR_USERNAME=" <myusername>"
@@ -120,6 +121,7 @@ export KEYFACTOR_DOMAIN="<mykeyfactordomain>" # Optional if username contains do
120
121
# ### oAuth Client Credentials
121
122
122
123
This is the minimum required configuration to authenticate to Keyfactor Command using oAuth client credentials.
124
+
123
125
` ` ` bash
124
126
export KEYFACTOR_HOSTNAME=" <mykeyfactorhost.mydomain.com>"
125
127
export KEYFACTOR_AUTH_CLIENT_ID=" <my-oauth2-client-id"
@@ -514,16 +516,49 @@ kfutil stores inventory remove \
514
516
515
517
## Development
516
518
517
- This CLI developed using [cobra](https://umarcor.github.io/cobra/)
519
+ This CLI developed using [cobra](https://umarcor.github.io/cobra/) for full developer details visit
520
+ the [user guide](https://github.com/spf13/cobra/blob/main/site/content/user_guide.md#user-guide)
521
+
522
+ ### Setup
523
+
524
+ To being development on `kfutil` you' ll need to perform the following:
525
+
526
+ 1. Install Go 1.20 or later [docs](https://golang.org/doc/install)
527
+ 2. Install the ` cobra-cli` generator [docs](https://github.com/spf13/cobra-cli/blob/main/README.md#cobra-generator)
528
+ 3. Clone the ` kfutil` [repository](https://github.com/Keyfactor/kfutil)
529
+ 4. Install the dependencies (` go mod tidy` )
530
+ 5. Run the generator to create the CLI
531
+ commands [docs](https://github.com/spf13/cobra-cli/blob/main/README.md#cobra-generator)
532
+
533
+ ` ` ` bash
534
+ git clone git@github.com:Keyfactor/kfutil.git
535
+ cd kfutil
536
+ go install github.com/spf13/cobra-cli@latest
537
+ go mod tidy
538
+ ` ` `
539
+
540
+ # ## Extending the CLI
518
541
519
- ### Adding a new command
542
+ This utility uses the [cobra](https://github.com/spf13/cobra-cli? tab=readme-ov-file#cobra-generator) CLI generator to
543
+ generate the CLI commands. The generator is installed via ` go install github.com/spf13/cobra-cli@latest` and
544
+ installed in ` $GOPATH /bin` . The generator is used to create the CLI commands and subcommands.
520
545
546
+ # ## Adding a new top-level command
547
+
548
+ To create a new top-level command, use the following command:
521
549
` ` ` bash
522
550
cobra-cli add < my-new-command>
523
551
` ` `
524
552
525
- alternatively you can specify the parent command
553
+ This will create a top level command named ` < my-new-command> ` and a file in ` cmd/< my-new-command> .go` . The command will
554
+ be ` kfutil < my-new-command> `
555
+
556
+ # ## Adding a new sub CLI command
526
557
558
+ To create a new sub command, use the following command:
527
559
` ` ` bash
528
- cobra-cli add <my-new-command> -p ' < parent> Cmd '
560
+ cobra-cli add < my-new-sub- command> -p ' <parent>'
529
561
` ` `
562
+
563
+ This will create a sub command named ` < my-new-sub-command> ` and a file in ` cmd/< my-new-sub-command> .go` . The
564
+ command will be ` kfutil < parent> < my-new-sub-command> `
0 commit comments