Skip to content
This repository was archived by the owner on Nov 7, 2023. It is now read-only.

Upgraded dependecny on urfave/cli module to unfrave/cli/v2 plus Refactored kr Commands to use aliases #302

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/paypal/gatt v0.0.0-20151011220935-4ae819d591cf // indirect
github.com/satori/go.uuid v1.2.0
github.com/urfave/cli v1.22.1
github.com/urfave/cli/v2 v2.2.0
github.com/youtube/vitess v2.1.1+incompatible
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
)
Expand Down
3 changes: 3 additions & 0 deletions src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5I
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
github.com/urfave/cli/v2 v2.2.0 h1:JTTnM6wKzdA0Jqodd966MVj4vWbbquZykeX1sKbe2C4=
github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
github.com/youtube/vitess v2.1.1+incompatible h1:SE+P7DNX/jw5RHFs5CHRhZQjq402EJFCD33JhzQMdDw=
github.com/youtube/vitess v2.1.1+incompatible/go.mod h1:hpMim5/30F1r+0P8GGtB29d0gWHr0IZ5unS+CG0zMx8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
2 changes: 1 addition & 1 deletion src/kr/debugaws.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"time"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
. "krypt.co/kr/common/analytics"
. "krypt.co/kr/common/util"
. "krypt.co/kr/common/aws"
Expand Down
124 changes: 66 additions & 58 deletions src/kr/kr.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"fmt"
"io"
"io/ioutil"
"krypt.co/kr/common/version"
"net/http"
"os"
"os/exec"
Expand All @@ -20,8 +19,9 @@ import (
"time"

"github.com/atotto/clipboard"
"github.com/urfave/cli"

"github.com/urfave/cli/v2"

"krypt.co/kr/common/version"
. "krypt.co/kr/common/analytics"
. "krypt.co/kr/common/persistance"
. "krypt.co/kr/common/protocol"
Expand Down Expand Up @@ -528,215 +528,223 @@ func main() {
app.Usage = "communicate with Krypton and krd - the Krypton daemon"
app.Version = version.CURRENT_VERSION.String()
app.Flags = []cli.Flag{}
app.Commands = []cli.Command{
cli.Command{
app.Commands = []*cli.Command{
{
Name: "pair",
Usage: "Initiate pairing of this workstation with a phone running Krypton",
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "force",
Usage: "Do not ask for confirmation to unpair a currently paired device",
},
cli.StringFlag{
&cli.StringFlag{
Name: "name, n",
Usage: "WorkstationName for this computer",
},
},
Action: pairCommand,
},
cli.Command{
{
Name: "me",
Usage: "Print your SSH public key",
Action: meCommand,
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
&cli.Command{
Name: "pgp",
Usage: "Print your PGP public key",
Action: mePGPCommand,
},
},
},
cli.Command{
{
Name: "codesign",
Usage: "Setup Krypton to sign git commits",
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "interactive, i",
Usage: "Prompt before each step",
},
},
Action: codesignCommand,
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
{
Name: "uninstall",
Usage: "Uninstall Krypton codesigning",
Action: codesignUninstallCommand,
},
cli.Command{
{
Name: "test",
Usage: "Test Krypton codesigning",
Action: codesignTestCommand,
},
cli.Command{
{
Name: "on",
Usage: "Turn on auto commit signing (requires git v2.0+)",
Action: codesignOnCommand,
},
cli.Command{
{
Name: "off",
Usage: "Turn off auto commit signing",
Action: codesignOffCommand,
},
},
},
cli.Command{
{
Name: "copy",
Usage: "Copy your SSH public key to the clipboard",
Action: copyCommand,
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
{
Name: "pgp",
Usage: "Copy your PGP public key to the clipboard.",
Action: copyPGPCommand,
},
},
},
cli.Command{
{
Name: "env",
Usage: "Print useful environment variables for configuring kr/krd",
Action: envCommand,
},
cli.Command{
{
Name: "sshconfig",
Usage: "Verify SSH is configured to use Krypton",
Action: sshConfigCommand,
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "print",
Usage: "Print Krypton SSH config block",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "force",
Usage: "Force append the Krypton SSH config block even if other Krypton-related lines are present",
},
},
},
cli.Command{
{
Name: "transfer",
Usage: "Authorize a new Krypton device to access of your servers",
Action: transferCommand,
Flags: []cli.Flag{
cli.BoolFlag{
&cli.BoolFlag{
Name: "dry-run, d",
Usage: "Do a dry-run and preview all servers that kr will try to add the new public key too",
},
},
},
cli.Command{
Name: "aws,bitbucket,digitalocean,gcp,github,ghe,gitlab,heroku",
Usage: "Upload your public key this service",
{
Name: "aws,bitbucket,digitalocean,gcp,github,ghe,gitlab,heroku",
Usage: "Upload your public key this service",
Action: func(c *cli.Context) (err error) {
PrintErr(os.Stderr, Red("Pick one service to upload your public key to!"))
return
},
},
cli.Command{
{
Name: "github",
Usage: "Upload your public key to GitHub. Copies your public key to the clipboard and opens GitHub settings",
Action: githubCommand,
Hidden: true,
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
{
Name: "pgp",
Usage: "Upload your PGP public key to GitHub. Copies your public key to the clipboard and opens GitHub settings",
Action: githubPGPCommand,
},
},
},
cli.Command{
{
Name: "ghe",
Usage: "Upload your public key to GitHub Enterprise. Copies your public key to the clipboard and opens GitHub Enterprise settings",
Action: gheCommand,
Hidden: true,
Subcommands: []cli.Command{
cli.Command{
Subcommands: []*cli.Command{
{
Name: "pgp",
Usage: "Upload your PGP public key to GitHub Enterprise. Copies your public key to the clipboard and opens GitHub Enterprise settings",
Action: ghePGPCommand,
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "url",
Usage: "GitHub Enterprise URL, i.e. github.mit.edu",
},
},
},
},
Flags: []cli.Flag{
cli.StringFlag{
&cli.StringFlag{
Name: "url",
Usage: "GitHub Enterprise URL, i.e. github.mit.edu",
},
},
},
cli.Command{
{
Name: "gitlab",
Usage: "Upload your public key to GitLab. Copies your public key to the clipboard and opens your GitLab profile",
Action: gitlabCommand,
Hidden: true,
},
cli.Command{
{
Name: "bitbucket",
Usage: "Upload your public key to BitBucket. Copies your public key to the clipboard and opens BitBucket settings",
Action: bitbucketCommand,
Hidden: true,
},
cli.Command{
Name: "digitalocean",
Usage: "Upload your public key to DigitalOcean. Copies your public key to the clipboard and opens DigitalOcean settings",
Action: digitaloceanCommand,
Hidden: true,
},
cli.Command{
Name: "digital-ocean",
Usage: "Upload your public key to DigitalOcean. Copies your public key to the clipboard and opens DigitalOcean settings",
Action: digitaloceanCommand,
Hidden: true,
{
Name: "digitalocean",
Aliases: []string{"digital-ocean"},
Usage: "Upload your public key to DigitalOcean. Copies your public key to the clipboard and opens DigitalOcean settings",
Action: digitaloceanCommand,
Hidden: true,
},
cli.Command{
{
Name: "heroku",
Usage: "Upload your public key to Heroku. Copies your public key to the clipboard and opens Heroku settings",
Action: herokuCommand,
Hidden: true,
},
cli.Command{
{
Name: "aws",
Usage: "Upload your public key to Amazon Web Services. Copies your public key to the clipboard and opens the AWS Console",
Action: awsCommand,
Hidden: true,
},
cli.Command{
{
Name: "gcp",
Usage: "Upload your public key to Google Cloud. Copies your public key to the clipboard and opens the Google Cloud Console",
Action: gcloudCommand,
Hidden: true,
},
cli.Command{
{
Name: "restart",
Usage: "Restart the Krypton daemon",
Action: restartCommand,
},
cli.Command{
{
Name: "upgrade",
Usage: "Upgrade Krypton on this workstation",
Action: upgradeCommand,
},
cli.Command{
{
Name: "update",
Action: upgradeCommand,
Hidden: true,
},
{
Name: "unpair",
Usage: "Unpair this workstation from a phone running Krypton",
Action: unpairCommand,
},
cli.Command{
{
Name: "uninstall",
Usage: "Uninstall Krypton from this workstation",
Action: uninstallCommand,
},
cli.Command{
{
Name: "remove",
Action: uninstallCommand,
},
{
Name: "debugaws",
Usage: "Check connectivity to AWS SQS",
Action: debugAWSCommand,
Expand Down
3 changes: 2 additions & 1 deletion src/kr/kr_pgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
"strings"
"time"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"

. "krypt.co/kr/common/util"
. "krypt.co/kr/common/analytics"
. "krypt.co/kr/daemon/client"
Expand Down
2 changes: 1 addition & 1 deletion src/kr/kr_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"os/exec"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
. "krypt.co/kr/common/analytics"
. "krypt.co/kr/common/socket"
)
Expand Down
2 changes: 1 addition & 1 deletion src/kr/sshconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"time"
"strconv"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"

. "krypt.co/kr/common/util"
)
Expand Down
3 changes: 2 additions & 1 deletion src/kr/transfer_authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (
"strings"
"time"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"

. "krypt.co/kr/common/persistance"
. "krypt.co/kr/common/protocol"
. "krypt.co/kr/common/socket"
Expand Down
Loading