-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
77 lines (73 loc) · 1.67 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"fmt"
"os"
"github.com/therealpaulgg/ssh-sync/pkg/actions"
"github.com/therealpaulgg/ssh-sync/pkg/actions/interactive"
"github.com/urfave/cli/v2"
)
var version string
func main() {
app := &cli.App{
Name: "ssh-sync",
Usage: "sync your ssh keys to a remote server",
Version: version,
Description: "Syncs your ssh keys to a remote server",
Commands: []*cli.Command{
{
Name: "setup",
Description: "Set up your system to use ssh-sync.",
Action: actions.Setup,
},
{
Name: "upload",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "path",
Aliases: []string{"p"},
Usage: "Path to the ssh keys",
},
},
Action: actions.Upload,
},
{
Name: "download",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "safe-mode",
Aliases: []string{"s"},
Usage: "Safe mode will sync to an alternate directory (.ssh-sync-data)",
},
},
Action: actions.Download,
},
{
Name: "challenge-response",
ArgsUsage: "[challenge-phrase]",
Action: actions.ChallengeResponse,
},
{
Name: "list-machines",
Action: actions.ListMachines,
},
{
Name: "remove-machine",
ArgsUsage: "[machine-name]",
Action: actions.RemoveMachine,
},
{
Name: "reset",
Action: actions.Reset,
},
{
Name: "interactive",
Description: "Uses a TUI mode for interacting with keys and config",
Usage: "Interactively manage your ssh keys with a TUI",
Action: interactive.Interactive,
},
},
}
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err.Error())
}
}