From 272f5c209ea2c1f42f0d1718f1322bad90552377 Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Mon, 13 Apr 2020 01:46:01 +0300 Subject: [PATCH] Add Command to Generate CLI Documentation This commands uses embedded info to generate markdown documentation for the CLI. --- cmd/docsGen.go | 24 ++++++++++++++++++ docs/kamanda.md | 35 ++++++++++++++++++++++++++ docs/kamanda_auth.md | 34 +++++++++++++++++++++++++ docs/kamanda_auth_addUser.md | 41 +++++++++++++++++++++++++++++++ docs/kamanda_auth_addUsers.md | 34 +++++++++++++++++++++++++ docs/kamanda_auth_customClaims.md | 33 +++++++++++++++++++++++++ docs/kamanda_auth_deleteUsers.md | 32 ++++++++++++++++++++++++ docs/kamanda_auth_find.md | 35 ++++++++++++++++++++++++++ docs/kamanda_auth_find_byEmail.md | 32 ++++++++++++++++++++++++ docs/kamanda_auth_find_byPhone.md | 32 ++++++++++++++++++++++++ docs/kamanda_auth_users.md | 33 +++++++++++++++++++++++++ docs/kamanda_docsGen.md | 32 ++++++++++++++++++++++++ docs/kamanda_login.md | 33 +++++++++++++++++++++++++ docs/kamanda_login:ci.md | 33 +++++++++++++++++++++++++ docs/kamanda_logout.md | 32 ++++++++++++++++++++++++ docs/kamanda_version.md | 32 ++++++++++++++++++++++++ go.sum | 3 +++ 17 files changed, 530 insertions(+) create mode 100644 cmd/docsGen.go create mode 100644 docs/kamanda.md create mode 100644 docs/kamanda_auth.md create mode 100644 docs/kamanda_auth_addUser.md create mode 100644 docs/kamanda_auth_addUsers.md create mode 100644 docs/kamanda_auth_customClaims.md create mode 100644 docs/kamanda_auth_deleteUsers.md create mode 100644 docs/kamanda_auth_find.md create mode 100644 docs/kamanda_auth_find_byEmail.md create mode 100644 docs/kamanda_auth_find_byPhone.md create mode 100644 docs/kamanda_auth_users.md create mode 100644 docs/kamanda_docsGen.md create mode 100644 docs/kamanda_login.md create mode 100644 docs/kamanda_login:ci.md create mode 100644 docs/kamanda_logout.md create mode 100644 docs/kamanda_version.md diff --git a/cmd/docsGen.go b/cmd/docsGen.go new file mode 100644 index 0000000..acdd23c --- /dev/null +++ b/cmd/docsGen.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "log" + + "github.com/spf13/cobra" + "github.com/spf13/cobra/doc" +) + +// docsGenCmd represents the docsGen command +var docsGenCmd = &cobra.Command{ + Use: "docsGen", + Short: "Generate Kamanda Documentation", + Run: func(cmd *cobra.Command, args []string) { + err := doc.GenMarkdownTree(rootCmd, "./docs") + if err != nil { + log.Fatal(err) + } + }, +} + +func init() { + rootCmd.AddCommand(docsGenCmd) +} diff --git a/docs/kamanda.md b/docs/kamanda.md new file mode 100644 index 0000000..8e49663 --- /dev/null +++ b/docs/kamanda.md @@ -0,0 +1,35 @@ +## kamanda + +Kamanda is an extender Firebase Tools CLI + +### Synopsis + +Kamanda is a Firebase CLI Tool extender and should be used alongside it. + +Kamanda provides additional functionality currently not available to via the +Firebase CLI Tool such as User Management, Cloud Firestore Management etc from the CLI. + +For instance, it allows you to easily create users with custom tokens, +which is always a trick preposition. + +### Options + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -h, --help help for kamanda + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + -t, --toggle Help message for toggle + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations +* [kamanda docsGen](kamanda_docsGen.md) - Generate Kamanda Documentation +* [kamanda login](kamanda_login.md) - Log kamanda into firebase +* [kamanda login:ci](kamanda_login:ci.md) - generate an access token for use in non-interactive environments +* [kamanda logout](kamanda_logout.md) - Logout kamanda from Firebase +* [kamanda version](kamanda_version.md) - Version will output the current build information + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth.md b/docs/kamanda_auth.md new file mode 100644 index 0000000..b1cb609 --- /dev/null +++ b/docs/kamanda_auth.md @@ -0,0 +1,34 @@ +## kamanda auth + +Perform Firebase Auth Operations + +### Synopsis + +Perform Firebase Auth Operations + +### Options + +``` + -h, --help help for auth +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda](kamanda.md) - Kamanda is an extender Firebase Tools CLI +* [kamanda auth addUser](kamanda_auth_addUser.md) - Add a new Firebase user +* [kamanda auth addUsers](kamanda_auth_addUsers.md) - Add multiple users from file (JSON/YAML) +* [kamanda auth customClaims](kamanda_auth_customClaims.md) - Add custom claims to firebase user or users +* [kamanda auth deleteUsers](kamanda_auth_deleteUsers.md) - Delete multiple Firebase Auth User by their UID +* [kamanda auth find](kamanda_auth_find.md) - Find a user by uid. To find user by email or by phone use `find byEmail` or `find byPhone` +* [kamanda auth users](kamanda_auth_users.md) - Get a list of users in firebase auth. + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_addUser.md b/docs/kamanda_auth_addUser.md new file mode 100644 index 0000000..8911668 --- /dev/null +++ b/docs/kamanda_auth_addUser.md @@ -0,0 +1,41 @@ +## kamanda auth addUser + +Add a new Firebase user + +### Synopsis + +Add a new Firebase user + +``` +kamanda auth addUser [flags] +``` + +### Options + +``` + -c, --customClaims stringToString user custom claims i.e. --customClaims "admin=true" (default []) + --email string the email of the new user + --emailVerified is the email verified + -h, --help help for addUser + --isDisabled is the user account disabled + --name string the name of the user + --password string the password of the new user + --phone string the phone number of the user + --photoURL string the photo url of the user + --uid string the uid of the user. autogenerated if absent +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_addUsers.md b/docs/kamanda_auth_addUsers.md new file mode 100644 index 0000000..a86b0f0 --- /dev/null +++ b/docs/kamanda_auth_addUsers.md @@ -0,0 +1,34 @@ +## kamanda auth addUsers + +Add multiple users from file (JSON/YAML) + +### Synopsis + +Add multiple users from file (JSON/YAML) + +``` +kamanda auth addUsers [flags] +``` + +### Options + +``` + -e, --extension string Source file type - json or yaml (default "yaml") + -h, --help help for addUsers + -s, --source string file with list of users to create +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_customClaims.md b/docs/kamanda_auth_customClaims.md new file mode 100644 index 0000000..20506d0 --- /dev/null +++ b/docs/kamanda_auth_customClaims.md @@ -0,0 +1,33 @@ +## kamanda auth customClaims + +Add custom claims to firebase user or users + +### Synopsis + +Add custom claims to firebase user or users + +``` +kamanda auth customClaims [flags] +``` + +### Options + +``` + -c, --customClaims stringToString user custom claims i.e. --customClaims "admin=true" (default []) + -h, --help help for customClaims +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_deleteUsers.md b/docs/kamanda_auth_deleteUsers.md new file mode 100644 index 0000000..3340b6f --- /dev/null +++ b/docs/kamanda_auth_deleteUsers.md @@ -0,0 +1,32 @@ +## kamanda auth deleteUsers + +Delete multiple Firebase Auth User by their UID + +### Synopsis + +Delete multiple Firebase Auth User by their UID + +``` +kamanda auth deleteUsers [flags] +``` + +### Options + +``` + -h, --help help for deleteUsers +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_find.md b/docs/kamanda_auth_find.md new file mode 100644 index 0000000..65f87fd --- /dev/null +++ b/docs/kamanda_auth_find.md @@ -0,0 +1,35 @@ +## kamanda auth find + +Find a user by uid. To find user by email or by phone use `find byEmail` or `find byPhone` + +### Synopsis + +Find a user by uid. To find user by email or by phone use `find byEmail` or `find byPhone` + +``` +kamanda auth find [flags] +``` + +### Options + +``` + -h, --help help for find + -t, --toggle Help message for toggle +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations +* [kamanda auth find byEmail](kamanda_auth_find_byEmail.md) - find a user by email address +* [kamanda auth find byPhone](kamanda_auth_find_byPhone.md) - find a user by phone number + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_find_byEmail.md b/docs/kamanda_auth_find_byEmail.md new file mode 100644 index 0000000..346e2c7 --- /dev/null +++ b/docs/kamanda_auth_find_byEmail.md @@ -0,0 +1,32 @@ +## kamanda auth find byEmail + +find a user by email address + +### Synopsis + +find a user by email address + +``` +kamanda auth find byEmail [flags] +``` + +### Options + +``` + -h, --help help for byEmail +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth find](kamanda_auth_find.md) - Find a user by uid. To find user by email or by phone use `find byEmail` or `find byPhone` + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_find_byPhone.md b/docs/kamanda_auth_find_byPhone.md new file mode 100644 index 0000000..153502f --- /dev/null +++ b/docs/kamanda_auth_find_byPhone.md @@ -0,0 +1,32 @@ +## kamanda auth find byPhone + +find a user by phone number + +### Synopsis + +find a user by phone number + +``` +kamanda auth find byPhone [flags] +``` + +### Options + +``` + -h, --help help for byPhone +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth find](kamanda_auth_find.md) - Find a user by uid. To find user by email or by phone use `find byEmail` or `find byPhone` + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_auth_users.md b/docs/kamanda_auth_users.md new file mode 100644 index 0000000..5454f5c --- /dev/null +++ b/docs/kamanda_auth_users.md @@ -0,0 +1,33 @@ +## kamanda auth users + +Get a list of users in firebase auth. + +### Synopsis + +Get a list of users in firebase auth. + +``` +kamanda auth users [flags] +``` + +### Options + +``` + -h, --help help for users + -n, --nextPageToken string Fetch next set of results +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda auth](kamanda_auth.md) - Perform Firebase Auth Operations + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_docsGen.md b/docs/kamanda_docsGen.md new file mode 100644 index 0000000..ce0d719 --- /dev/null +++ b/docs/kamanda_docsGen.md @@ -0,0 +1,32 @@ +## kamanda docsGen + +Generate Kamanda Documentation + +### Synopsis + +Generate Kamanda Documentation + +``` +kamanda docsGen [flags] +``` + +### Options + +``` + -h, --help help for docsGen +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda](kamanda.md) - Kamanda is an extender Firebase Tools CLI + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_login.md b/docs/kamanda_login.md new file mode 100644 index 0000000..2b74451 --- /dev/null +++ b/docs/kamanda_login.md @@ -0,0 +1,33 @@ +## kamanda login + +Log kamanda into firebase + +### Synopsis + +Log kamanda into firebase + +``` +kamanda login [flags] +``` + +### Options + +``` + -h, --help help for login + --no-localhost copy and paste a code instead of starting a local server for authentication +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda](kamanda.md) - Kamanda is an extender Firebase Tools CLI + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_login:ci.md b/docs/kamanda_login:ci.md new file mode 100644 index 0000000..b383c9f --- /dev/null +++ b/docs/kamanda_login:ci.md @@ -0,0 +1,33 @@ +## kamanda login:ci + +generate an access token for use in non-interactive environments + +### Synopsis + +generate an access token for use in non-interactive environments + +``` +kamanda login:ci [flags] +``` + +### Options + +``` + -h, --help help for login:ci + --no-localhost copy and paste a code instead of starting a local server for authentication +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda](kamanda.md) - Kamanda is an extender Firebase Tools CLI + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_logout.md b/docs/kamanda_logout.md new file mode 100644 index 0000000..8973ab5 --- /dev/null +++ b/docs/kamanda_logout.md @@ -0,0 +1,32 @@ +## kamanda logout + +Logout kamanda from Firebase + +### Synopsis + +Logout kamanda from Firebase + +``` +kamanda logout [flags] +``` + +### Options + +``` + -h, --help help for logout +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda](kamanda.md) - Kamanda is an extender Firebase Tools CLI + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/docs/kamanda_version.md b/docs/kamanda_version.md new file mode 100644 index 0000000..843cb93 --- /dev/null +++ b/docs/kamanda_version.md @@ -0,0 +1,32 @@ +## kamanda version + +Version will output the current build information + +### Synopsis + +Version will output the current build information + +``` +kamanda version [flags] +``` + +### Options + +``` + -h, --help help for version +``` + +### Options inherited from parent commands + +``` + --config string config file (default is $HOME/.kamanda/config.json) + -o, --output string A file where data from firebase will be saved. + -P, --project string The firebase project to use (default "default") + --token string firebase token to use for authentication +``` + +### SEE ALSO + +* [kamanda](kamanda.md) - Kamanda is an extender Firebase Tools CLI + +###### Auto generated by spf13/cobra on 13-Apr-2020 diff --git a/go.sum b/go.sum index 3488eab..3f1eabf 100644 --- a/go.sum +++ b/go.sum @@ -70,6 +70,7 @@ github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -218,7 +219,9 @@ github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=