Skip to content

Commit

Permalink
Merge pull request #1270 from the-skycoin-project/srvpk
Browse files Browse the repository at this point in the history
add skywire-cli subcommands
  • Loading branch information
jdknives authored Jun 30, 2022
2 parents 90d9f73 + 77ce818 commit d083377
Show file tree
Hide file tree
Showing 37 changed files with 1,688 additions and 806 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/apps/
/skywire/
/local/*
/local*/*
/transport_logs
/dmsgpty

Expand Down
3 changes: 1 addition & 2 deletions cmd/skywire-cli/commands/completion/completion.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package completion
package clicompletion

import (
"os"
Expand All @@ -10,7 +10,6 @@ import (
var RootCmd = &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Short: "Generate completion script",
Long: "To load completions",
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Expand Down
42 changes: 2 additions & 40 deletions cmd/skywire-cli/commands/config/gen.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package config
package cliconfig

import (
"encoding/json"
Expand All @@ -16,49 +16,11 @@ import (
"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire-utilities/pkg/netutil"
utilenv "github.com/skycoin/skywire-utilities/pkg/skyenv"
"github.com/skycoin/skywire/pkg/app/appserver"
"github.com/skycoin/skywire/pkg/skyenv"
"github.com/skycoin/skywire/pkg/visor/visorconfig"
)

var (
sk cipher.SecKey
output string
confPath string
configName string
stdout bool
regen bool
retainHypervisors bool
testEnv bool
ptext string
pkgEnv bool
usrEnv bool
hypervisor bool
hypervisorPKs string
dmsgHTTP bool
publicRPC bool
vpnServerEnable bool
disableauth bool
enableauth bool
selectedOS string
disableApps string
bestProtocol bool
serviceConfURL string
services *visorconfig.Services
force bool
hide bool
all bool
outunset bool
ver string
root bool
svcconf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //skyenv.DefaultServiceConfAddr
testconf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //skyenv.DefaultServiceConfAddr
hiddenflags []string
binPath string
logLevel string
)

func init() {
//disable sorting, flags appear in the order shown here
genConfigCmd.Flags().SortFlags = false
Expand Down Expand Up @@ -126,7 +88,7 @@ func init() {

var genConfigCmd = &cobra.Command{
Use: "gen",
Short: "generate a config file",
Short: "Generate a config file",
PreRun: func(cmd *cobra.Command, _ []string) {
//--all unhides flags, prints help menu, and exits
if all {
Expand Down
69 changes: 64 additions & 5 deletions cmd/skywire-cli/commands/config/root.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,76 @@
package config
package cliconfig

import (
"strings"

"github.com/spf13/cobra"

"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/logging"
"github.com/skycoin/skywire/cmd/skywire-cli/commands/config/update"
utilenv "github.com/skycoin/skywire-utilities/pkg/skyenv"
"github.com/skycoin/skywire/pkg/visor/visorconfig"
)

var logger = logging.MustGetLogger("skywire-cli")

func init() {
RootCmd.AddCommand(update.RootCmd)
}
var (
sk cipher.SecKey
output string
confPath string
configName string
stdout bool
regen bool
retainHypervisors bool
testEnv bool
ptext string
pkgEnv bool
usrEnv bool
hypervisor bool
hypervisorPKs string
dmsgHTTP bool
publicRPC bool
vpnServerEnable bool
disableauth bool
enableauth bool
selectedOS string
disableApps string
bestProtocol bool
serviceConfURL string
services *visorconfig.Services
force bool
hide bool
all bool
outunset bool
ver string
root bool
svcconf = strings.ReplaceAll(utilenv.ServiceConfAddr, "http://", "") //skyenv.DefaultServiceConfAddr
testconf = strings.ReplaceAll(utilenv.TestServiceConfAddr, "http://", "") //skyenv.DefaultServiceConfAddr
hiddenflags []string
binPath string
logLevel string
pkg bool
input string
updateEndpoints bool
addHypervisorPKs string
resetHypervisor bool
setVPNClientKillswitch string
addVPNClientSrv string
addVPNClientPasscode string
resetVPNclient bool
addVPNServerPasscode string
setVPNServerSecure string
setVPNServerAutostart string
setVPNServerNetIfc string
resetVPNServer bool
addSkysocksClientSrv string
resetSkysocksClient bool
skysocksPasscode string
resetSkysocks bool
setPublicAutoconnect string
minHops int
conf *visorconfig.V1
usr bool
)

// RootCmd contains commands that interact with the config of local skywire-visor
var RootCmd = &cobra.Command{
Expand Down
Loading

0 comments on commit d083377

Please sign in to comment.