From ce8a27d80ae274a0fe3b95f1bededdfd03f92920 Mon Sep 17 00:00:00 2001 From: Marcin S Date: Wed, 5 Aug 2020 13:51:46 +0200 Subject: [PATCH] Add connection options and re-generate docs --- .gitignore | 2 +- cmd/skynet/main.go | 6 +++++- cmd/skynet/skynetcmd.go | 3 +++ doc/README.md | 12 ++++++++---- doc/skynet.md | 12 ++++++++---- doc/skynet_blacklist.md | 7 +++++-- doc/skynet_convert.md | 7 +++++-- doc/skynet_download.md | 11 ++++++++--- doc/skynet_ls.md | 7 +++++-- doc/skynet_pin.md | 7 +++++-- doc/skynet_skykey.md | 32 ++++++++++++++++++++++++++++++++ doc/skynet_skykey_add.md | 32 ++++++++++++++++++++++++++++++++ doc/skynet_skykey_create.md | 32 ++++++++++++++++++++++++++++++++ doc/skynet_skykey_get.md | 30 ++++++++++++++++++++++++++++++ doc/skynet_skykey_get_id.md | 32 ++++++++++++++++++++++++++++++++ doc/skynet_skykey_get_name.md | 32 ++++++++++++++++++++++++++++++++ doc/skynet_skykey_list.md | 32 ++++++++++++++++++++++++++++++++ doc/skynet_unpin.md | 7 +++++-- doc/skynet_upload.md | 11 ++++++++--- go.mod | 2 +- go.sum | 2 ++ 21 files changed, 291 insertions(+), 27 deletions(-) create mode 100644 doc/skynet_skykey.md create mode 100644 doc/skynet_skykey_add.md create mode 100644 doc/skynet_skykey_create.md create mode 100644 doc/skynet_skykey_get.md create mode 100644 doc/skynet_skykey_get_id.md create mode 100644 doc/skynet_skykey_get_name.md create mode 100644 doc/skynet_skykey_list.md diff --git a/.gitignore b/.gitignore index 7b3c968..2a2fe30 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ cover/ release/ skynet -# Git +# Git .git diff --git a/cmd/skynet/main.go b/cmd/skynet/main.go index 8ff08ba..52c2e2f 100644 --- a/cmd/skynet/main.go +++ b/cmd/skynet/main.go @@ -41,6 +41,9 @@ var ( // endpointPath is the relative URL path of the endpoint. endpointPath string + // apiKey is the API password to use for authentication. + apiKey string + // customUserAgent is the custom user agent to use. customUserAgent string @@ -144,9 +147,10 @@ on top of Sia.`, skynetSkykeyGetCmd.AddCommand(skynetSkykeyGetIDCmd, skynetSkykeyGetNameCmd) // Add flags. - rootCmd.Flags().BoolVarP(&generateDocs, "", "d", false, "Generate the docs for skynet") + rootCmd.Flags().BoolVarP(&generateDocs, "generate-docs", "d", false, "Generate the docs for skynet") rootCmd.PersistentFlags().StringVar(&skynetPortal, "portal", "", "Use a Skynet portal other than the default") rootCmd.PersistentFlags().StringVar(&endpointPath, "endpoint-path", "", "Relative URL path of the endpoint to use") + rootCmd.PersistentFlags().StringVar(&apiKey, "api-key", "", "API password to use for authentication") rootCmd.PersistentFlags().StringVar(&customUserAgent, "custom-user-agent", "", "Custom user agent to use") // Upload flags. skynetUploadCmd.Flags().StringVar(&portalFileFieldName, "file-field-name", "", "Defines the fieldName for the files on the portal") diff --git a/cmd/skynet/skynetcmd.go b/cmd/skynet/skynetcmd.go index 1a19d99..e83e0a4 100644 --- a/cmd/skynet/skynetcmd.go +++ b/cmd/skynet/skynetcmd.go @@ -362,6 +362,9 @@ func getCommonOptions(opts skynet.Options) skynet.Options { if endpointPath != "" { opts.EndpointPath = endpointPath } + if apiKey != "" { + opts.APIKey = apiKey + } if customUserAgent != "" { opts.CustomUserAgent = customUserAgent } diff --git a/doc/README.md b/doc/README.md index 5e5b084..9517d88 100644 --- a/doc/README.md +++ b/doc/README.md @@ -14,9 +14,12 @@ skynet [flags] ### Options ``` - -d, -- Generate the docs for skynet - -h, --help help for skynet - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + -d, --generate-docs Generate the docs for skynet + -h, --help help for skynet + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO @@ -26,7 +29,8 @@ skynet [flags] * [skynet download](skynet_download.md) - Download a skylink from skynet. * [skynet ls](skynet_ls.md) - Needs SDK Implementation * [skynet pin](skynet_pin.md) - Needs SDK Implementation +* [skynet skykey](skynet_skykey.md) - Perform skykey operations. * [skynet unpin](skynet_unpin.md) - Needs SDK Implementation * [skynet upload](skynet_upload.md) - Upload a file or a directory to Skynet. -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet.md b/doc/skynet.md index 5e5b084..9517d88 100644 --- a/doc/skynet.md +++ b/doc/skynet.md @@ -14,9 +14,12 @@ skynet [flags] ### Options ``` - -d, -- Generate the docs for skynet - -h, --help help for skynet - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + -d, --generate-docs Generate the docs for skynet + -h, --help help for skynet + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO @@ -26,7 +29,8 @@ skynet [flags] * [skynet download](skynet_download.md) - Download a skylink from skynet. * [skynet ls](skynet_ls.md) - Needs SDK Implementation * [skynet pin](skynet_pin.md) - Needs SDK Implementation +* [skynet skykey](skynet_skykey.md) - Perform skykey operations. * [skynet unpin](skynet_unpin.md) - Needs SDK Implementation * [skynet upload](skynet_upload.md) - Upload a file or a directory to Skynet. -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_blacklist.md b/doc/skynet_blacklist.md index 405ee24..e1a5378 100644 --- a/doc/skynet_blacklist.md +++ b/doc/skynet_blacklist.md @@ -19,11 +19,14 @@ skynet blacklist [skylink] [flags] ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_convert.md b/doc/skynet_convert.md index 0eb40fc..b5c976a 100644 --- a/doc/skynet_convert.md +++ b/doc/skynet_convert.md @@ -19,11 +19,14 @@ skynet convert [source siaPath] [destination siaPath] [flags] ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_download.md b/doc/skynet_download.md index 79e2241..d3c72e9 100644 --- a/doc/skynet_download.md +++ b/doc/skynet_download.md @@ -14,17 +14,22 @@ skynet download [skylink] [destination] [flags] ### Options ``` - -h, --help help for download + -h, --help help for download + --skykey-id string ID of the skykey on the portal used to decrypt the download + --skykey-name string Name of the skykey on the portal used to decrypt the download ``` ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_ls.md b/doc/skynet_ls.md index b69e33d..5cd62be 100644 --- a/doc/skynet_ls.md +++ b/doc/skynet_ls.md @@ -19,11 +19,14 @@ skynet ls [flags] ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_pin.md b/doc/skynet_pin.md index a14fae4..5a66af5 100644 --- a/doc/skynet_pin.md +++ b/doc/skynet_pin.md @@ -19,11 +19,14 @@ skynet pin [skylink] [destination siapath] [flags] ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey.md b/doc/skynet_skykey.md new file mode 100644 index 0000000..7eea4e2 --- /dev/null +++ b/doc/skynet_skykey.md @@ -0,0 +1,32 @@ +## skynet skykey + +Perform skykey operations. + +### Synopsis + +Perform skykey operations. + +### Options + +``` + -h, --help help for skykey +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet](skynet.md) - Perform actions related to Skynet +* [skynet skykey add](skynet_skykey_add.md) - Add a skykey to Skynet. +* [skynet skykey create](skynet_skykey_create.md) - Create a skykey on Skynet. +* [skynet skykey get](skynet_skykey_get.md) - Perform skykey get operations. +* [skynet skykey list](skynet_skykey_list.md) - Get a list of all skykeys on Skynet. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey_add.md b/doc/skynet_skykey_add.md new file mode 100644 index 0000000..42d89da --- /dev/null +++ b/doc/skynet_skykey_add.md @@ -0,0 +1,32 @@ +## skynet skykey add + +Add a skykey to Skynet. + +### Synopsis + +Store the given base-64 encoded skykey with the skykey manager. + +``` +skynet skykey add [skykey] [flags] +``` + +### Options + +``` + -h, --help help for add +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet skykey](skynet_skykey.md) - Perform skykey operations. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey_create.md b/doc/skynet_skykey_create.md new file mode 100644 index 0000000..4dcbce8 --- /dev/null +++ b/doc/skynet_skykey_create.md @@ -0,0 +1,32 @@ +## skynet skykey create + +Create a skykey on Skynet. + +### Synopsis + +Returns a new skykey created and stored under that name. + +``` +skynet skykey create [skykey name] [flags] +``` + +### Options + +``` + -h, --help help for create +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet skykey](skynet_skykey.md) - Perform skykey operations. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey_get.md b/doc/skynet_skykey_get.md new file mode 100644 index 0000000..de3bd73 --- /dev/null +++ b/doc/skynet_skykey_get.md @@ -0,0 +1,30 @@ +## skynet skykey get + +Perform skykey get operations. + +### Synopsis + +Perform skykey get operations. + +### Options + +``` + -h, --help help for get +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet skykey](skynet_skykey.md) - Perform skykey operations. +* [skynet skykey get id](skynet_skykey_get_id.md) - Get a skykey given its ID. +* [skynet skykey get name](skynet_skykey_get_name.md) - Get a skykey given its name. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey_get_id.md b/doc/skynet_skykey_get_id.md new file mode 100644 index 0000000..5b8c9b0 --- /dev/null +++ b/doc/skynet_skykey_get_id.md @@ -0,0 +1,32 @@ +## skynet skykey get id + +Get a skykey given its ID. + +### Synopsis + +Get a skykey given its ID. + +``` +skynet skykey get id [skykey id] [flags] +``` + +### Options + +``` + -h, --help help for id +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet skykey get](skynet_skykey_get.md) - Perform skykey get operations. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey_get_name.md b/doc/skynet_skykey_get_name.md new file mode 100644 index 0000000..a8afddb --- /dev/null +++ b/doc/skynet_skykey_get_name.md @@ -0,0 +1,32 @@ +## skynet skykey get name + +Get a skykey given its name. + +### Synopsis + +Get a skykey given its name. + +``` +skynet skykey get name [skykey name] [flags] +``` + +### Options + +``` + -h, --help help for name +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet skykey get](skynet_skykey_get.md) - Perform skykey get operations. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_skykey_list.md b/doc/skynet_skykey_list.md new file mode 100644 index 0000000..b567826 --- /dev/null +++ b/doc/skynet_skykey_list.md @@ -0,0 +1,32 @@ +## skynet skykey list + +Get a list of all skykeys on Skynet. + +### Synopsis + +Get a list of all skykeys on Skynet. + +``` +skynet skykey list [flags] +``` + +### Options + +``` + -h, --help help for list +``` + +### Options inherited from parent commands + +``` + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default +``` + +### SEE ALSO + +* [skynet skykey](skynet_skykey.md) - Perform skykey operations. + +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_unpin.md b/doc/skynet_unpin.md index d2a1dfb..158af6e 100644 --- a/doc/skynet_unpin.md +++ b/doc/skynet_unpin.md @@ -19,11 +19,14 @@ skynet unpin [siapath] [flags] ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/doc/skynet_upload.md b/doc/skynet_upload.md index 8c83b78..d36ec48 100644 --- a/doc/skynet_upload.md +++ b/doc/skynet_upload.md @@ -19,20 +19,25 @@ skynet upload [source path] [flags] ``` --directory-field-name string Defines the fieldName for the directory files on the portal + --dirname string Custom dirname for the uploaded directory --file-field-name string Defines the fieldName for the files on the portal --filename string Custom filename for the uploaded file -h, --help help for upload - --upload-path string Relative URL path of the upload endpoint + --skykey-id string ID of the skykey on the portal used to encrypt the upload + --skykey-name string Name of the skykey on the portal used to encrypt the upload ``` ### Options inherited from parent commands ``` - --portal string Use a Skynet portal other than the default + --api-key string API password to use for authentication + --custom-user-agent string Custom user agent to use + --endpoint-path string Relative URL path of the endpoint to use + --portal string Use a Skynet portal other than the default ``` ### SEE ALSO * [skynet](skynet.md) - Perform actions related to Skynet -###### Auto generated by spf13/cobra on 18-Jun-2020 +###### Auto generated by spf13/cobra on 5-Aug-2020 diff --git a/go.mod b/go.mod index c9cc91d..0fa82c7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/NebulousLabs/skynet-cli go 1.13 require ( - github.com/NebulousLabs/go-skynet v0.0.0-20200721163935-c56e138c1a03 + github.com/NebulousLabs/go-skynet v0.0.0-20200805105931-985c5804db66 github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 // indirect gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8 diff --git a/go.sum b/go.sum index 1bb2add..241dc32 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ github.com/NebulousLabs/go-skynet v0.0.0-20200615123241-9b30d4ffd492 h1:KPJHmIBb github.com/NebulousLabs/go-skynet v0.0.0-20200615123241-9b30d4ffd492/go.mod h1:uOpyXOndZfQYn/hIdGgR0DJCK2I4uz+NNmXtxlaCUyg= github.com/NebulousLabs/go-skynet v0.0.0-20200721163935-c56e138c1a03 h1:E+UMrK7thvS73wxDhTgE35fxN0hSCT6KBI2vWao4zj8= github.com/NebulousLabs/go-skynet v0.0.0-20200721163935-c56e138c1a03/go.mod h1:6vr7Kb2aMpGrAuLmZ2LOtuqLusO1ISRglRXDv+vkmdI= +github.com/NebulousLabs/go-skynet v0.0.0-20200805105931-985c5804db66 h1:dboQMHW8YhTQcsjnBB/s4ZPXk/O1Jf8R6O9BaStll2o= +github.com/NebulousLabs/go-skynet v0.0.0-20200805105931-985c5804db66/go.mod h1:6vr7Kb2aMpGrAuLmZ2LOtuqLusO1ISRglRXDv+vkmdI= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=