aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/access.go
diff options
context:
space:
mode:
authorElad <theman@elad.im>2018-10-12 20:51:38 +0800
committerAnton Evangelatov <anton.evangelatov@gmail.com>2018-10-12 20:51:38 +0800
commit4868964bb99facd8cc6149626023e64db14a6742 (patch)
tree858bfaddcb1f1381e3bb2e0dd4c72aed397e621d /cmd/swarm/access.go
parent6f607de5d590ff2fbe8798b04e5924be3b7ca0b4 (diff)
downloadgo-tangerine-4868964bb99facd8cc6149626023e64db14a6742.tar
go-tangerine-4868964bb99facd8cc6149626023e64db14a6742.tar.gz
go-tangerine-4868964bb99facd8cc6149626023e64db14a6742.tar.bz2
go-tangerine-4868964bb99facd8cc6149626023e64db14a6742.tar.lz
go-tangerine-4868964bb99facd8cc6149626023e64db14a6742.tar.xz
go-tangerine-4868964bb99facd8cc6149626023e64db14a6742.tar.zst
go-tangerine-4868964bb99facd8cc6149626023e64db14a6742.zip
cmd/swarm: split flags and cli command declarations to the relevant files (#17896)
Diffstat (limited to 'cmd/swarm/access.go')
-rw-r--r--cmd/swarm/access.go60
1 files changed, 59 insertions, 1 deletions
diff --git a/cmd/swarm/access.go b/cmd/swarm/access.go
index dd2d513c2..629781edd 100644
--- a/cmd/swarm/access.go
+++ b/cmd/swarm/access.go
@@ -29,7 +29,65 @@ import (
"gopkg.in/urfave/cli.v1"
)
-var salt = make([]byte, 32)
+var (
+ salt = make([]byte, 32)
+ accessCommand = cli.Command{
+ CustomHelpTemplate: helpTemplate,
+ Name: "access",
+ Usage: "encrypts a reference and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root manifest",
+ Subcommands: []cli.Command{
+ {
+ CustomHelpTemplate: helpTemplate,
+ Name: "new",
+ Usage: "encrypts a reference and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ Subcommands: []cli.Command{
+ {
+ Action: accessNewPass,
+ CustomHelpTemplate: helpTemplate,
+ Flags: []cli.Flag{
+ utils.PasswordFileFlag,
+ SwarmDryRunFlag,
+ },
+ Name: "pass",
+ Usage: "encrypts a reference with a password and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ },
+ {
+ Action: accessNewPK,
+ CustomHelpTemplate: helpTemplate,
+ Flags: []cli.Flag{
+ utils.PasswordFileFlag,
+ SwarmDryRunFlag,
+ SwarmAccessGrantKeyFlag,
+ },
+ Name: "pk",
+ Usage: "encrypts a reference with the node's private key and a given grantee's public key and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ },
+ {
+ Action: accessNewACT,
+ CustomHelpTemplate: helpTemplate,
+ Flags: []cli.Flag{
+ SwarmAccessGrantKeysFlag,
+ SwarmDryRunFlag,
+ utils.PasswordFileFlag,
+ },
+ Name: "act",
+ Usage: "encrypts a reference with the node's private key and a given grantee's public key and embeds it into a root manifest",
+ ArgsUsage: "<ref>",
+ Description: "encrypts a reference and embeds it into a root access manifest and prints the resulting manifest",
+ },
+ },
+ },
+ },
+ }
+)
func init() {
if _, err := io.ReadFull(rand.Reader, salt); err != nil {