Skip to content

Commit cc6489a

Browse files
committed
chore(docs): Update developer docs with more references and setup steps.
Signed-off-by: spbsoluble <1661003+spbsoluble@users.noreply.github.com>
1 parent 0c05396 commit cc6489a

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ Below are examples of setting the environment variables in Linux/MacOS to be use
110110

111111
This is the minimum required configuration to authenticate to Keyfactor Command using Active Directory username,
112112
password auth.
113+
113114
```bash
114115
export KEYFACTOR_HOSTNAME="<mykeyfactorhost.mydomain.com>"
115116
export KEYFACTOR_USERNAME="<myusername>"
@@ -120,6 +121,7 @@ export KEYFACTOR_DOMAIN="<mykeyfactordomain>" # Optional if username contains do
120121
#### oAuth Client Credentials
121122

122123
This is the minimum required configuration to authenticate to Keyfactor Command using oAuth client credentials.
124+
123125
```bash
124126
export KEYFACTOR_HOSTNAME="<mykeyfactorhost.mydomain.com>"
125127
export KEYFACTOR_AUTH_CLIENT_ID="<my-oauth2-client-id"
@@ -514,16 +516,49 @@ kfutil stores inventory remove \
514516
515517
## Development
516518
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
518541
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.
520545
546+
### Adding a new top-level command
547+
548+
To create a new top-level command, use the following command:
521549
```bash
522550
cobra-cli add <my-new-command>
523551
```
524552
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
526557
558+
To create a new sub command, use the following command:
527559
```bash
528-
cobra-cli add <my-new-command> -p '<parent>Cmd'
560+
cobra-cli add <my-new-sub-command> -p '<parent>'
529561
```
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

Comments
 (0)