Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve help menus ; update vendor deps #1752

Merged
merged 2 commits into from
Mar 6, 2024
Merged
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
94 changes: 42 additions & 52 deletions cmd/skywire-deployment/skywire.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ func init() {
RootCmd.AddCommand(
visor.RootCmd,
scli.RootCmd,
sn.RootCmd, //help menu doesn't appear correctly for setup-node unless this is included here
svcCmd,
dmsgCmd,
appsCmd,
Expand All @@ -108,11 +107,39 @@ func init() {
└─┘┴ ┴ ┴ └┴┘┴┴└─└─┘ └┘ ┴└─┘└─┘┴└─`
dmsgcurl.RootCmd.Use = "curl"
dmsgweb.RootCmd.Use = "web"
sn.RootCmd.Use = "sn"
ssmon.RootCmd.Use = "ssm"
dmsgptycli.RootCmd.Use = "cli"
dmsgptyhost.RootCmd.Use = "host"
dmsgptyui.RootCmd.Use = "ui"
dmsgdisc.RootCmd.Use = "disc"
dmsgserver.RootCmd.Use = "server"
dmsghttp.RootCmd.Use = "http"
dmsgcurl.RootCmd.Use = "curl"
dmsgweb.RootCmd.Use = "web"
dmsgsocks.RootCmd.Use = "socks"
dmsgmon.RootCmd.Use = "mon"
tpd.RootCmd.Use = "tpd"
tps.RootCmd.Use = "tps"
ar.RootCmd.Use = "ar"
rf.RootCmd.Use = "rf"
confbs.RootCmd.Use = "cb"
kg.RootCmd.Use = "kg"
lc.RootCmd.Use = "lc"
nv.RootCmd.Use = "nv"
vpnmon.RootCmd.Use = "vpnm"
pvmon.RootCmd.Use = "pvm"
ssmon.RootCmd.Use = "ssm"
nwmon.RootCmd.Use = "nwmon"
se.RootCmd.Use = "se"
sd.RootCmd.Use = "sd"
sn.RootCmd.Use = "sn"
scli.RootCmd.Use = "cli"
visor.RootCmd.Use = "visor"
vpns.RootCmd.Use = "vpns"
vpnc.RootCmd.Use = "vpnc"
ssc.RootCmd.Use = "ssc"
ss.RootCmd.Use = "ss"
sc.RootCmd.Use = "sc"

var helpflag bool
RootCmd.SetUsageTemplate(help)
RootCmd.PersistentFlags().BoolVarP(&helpflag, "help", "h", false, "help for "+RootCmd.Use)
Expand Down Expand Up @@ -352,56 +379,19 @@ var docCmd = &cobra.Command{
},
}

var commands = []*cobra.Command{
dmsgptycli.RootCmd,
dmsgptyhost.RootCmd,
dmsgptyui.RootCmd,
dmsgptyCmd,
dmsgdisc.RootCmd,
dmsgserver.RootCmd,
dmsghttp.RootCmd,
dmsgcurl.RootCmd,
dmsgweb.RootCmd,
dmsgCmd,
tpd.RootCmd,
tps.RootCmd,
ar.RootCmd,
rf.RootCmd,
confbs.RootCmd,
kg.RootCmd,
lc.RootCmd,
nv.RootCmd,
pvmon.RootCmd,
se.RootCmd,
sd.RootCmd,
svcCmd,
sn.RootCmd,
visor.RootCmd,
scli.RootCmd,
vpns.RootCmd,
vpnc.RootCmd,
ssc.RootCmd,
ss.RootCmd,
sc.RootCmd,
appsCmd,
RootCmd,
}

func main() {
for _, cmd := range commands {
cc.Init(&cc.Config{
RootCmd: cmd,
Headings: cc.HiBlue + cc.Bold,
Commands: cc.HiBlue + cc.Bold,
CmdShortDescr: cc.HiBlue,
Example: cc.HiBlue + cc.Italic,
ExecName: cc.HiBlue + cc.Bold,
Flags: cc.HiBlue + cc.Bold,
FlagsDescr: cc.HiBlue,
NoExtraNewlines: true,
NoBottomNewline: true,
})
}
cc.Init(&cc.Config{
RootCmd: RootCmd,
Headings: cc.HiBlue + cc.Bold,
Commands: cc.HiBlue + cc.Bold,
CmdShortDescr: cc.HiBlue,
Example: cc.HiBlue + cc.Italic,
ExecName: cc.HiBlue + cc.Bold,
Flags: cc.HiBlue + cc.Bold,
FlagsDescr: cc.HiBlue,
NoExtraNewlines: true,
NoBottomNewline: true,
})
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
}
Expand Down
95 changes: 45 additions & 50 deletions cmd/skywire/skywire.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,55 @@ import (
"github.com/spf13/cobra"

"github.com/skycoin/skywire-utilities/pkg/buildinfo"
skychat "github.com/skycoin/skywire/cmd/apps/skychat/commands"
skysocksclient "github.com/skycoin/skywire/cmd/apps/skysocks-client/commands"
skysocks "github.com/skycoin/skywire/cmd/apps/skysocks/commands"
vpnclient "github.com/skycoin/skywire/cmd/apps/vpn-client/commands"
vpnserver "github.com/skycoin/skywire/cmd/apps/vpn-server/commands"
setupnode "github.com/skycoin/skywire/cmd/setup-node/commands"
skywirecli "github.com/skycoin/skywire/cmd/skywire-cli/commands"
sc "github.com/skycoin/skywire/cmd/apps/skychat/commands"
ssc "github.com/skycoin/skywire/cmd/apps/skysocks-client/commands"
ss "github.com/skycoin/skywire/cmd/apps/skysocks/commands"
vpnc "github.com/skycoin/skywire/cmd/apps/vpn-client/commands"
vpns "github.com/skycoin/skywire/cmd/apps/vpn-server/commands"
sn "github.com/skycoin/skywire/cmd/setup-node/commands"
cli "github.com/skycoin/skywire/cmd/skywire-cli/commands"
"github.com/skycoin/skywire/pkg/visor"
)

func init() {
appsCmd.AddCommand(
vpnserver.RootCmd,
vpnclient.RootCmd,
skysocksclient.RootCmd,
skysocks.RootCmd,
skychat.RootCmd,
vpns.RootCmd,
vpnc.RootCmd,
ssc.RootCmd,
ss.RootCmd,
sc.RootCmd,
)
rootCmd.AddCommand(
RootCmd.AddCommand(
visor.RootCmd,
skywirecli.RootCmd,
setupnode.RootCmd,
cli.RootCmd,
sn.RootCmd,
appsCmd,
)
visor.RootCmd.Long = `
┌─┐┬┌─┬ ┬┬ ┬┬┬─┐┌─┐ ┬ ┬┬┌─┐┌─┐┬─┐
└─┐├┴┐└┬┘││││├┬┘├┤───└┐┌┘│└─┐│ │├┬┘
└─┘┴ ┴ ┴ └┴┘┴┴└─└─┘ └┘ ┴└─┘└─┘┴└─`
setupnode.RootCmd.Use = "sn"
visor.RootCmd.Use = "visor"
cli.RootCmd.Use = "cli"
sn.RootCmd.Use = "sn"
vpns.RootCmd.Use = "vpns"
vpnc.RootCmd.Use = "vpnc"
ssc.RootCmd.Use = "ssc"
ss.RootCmd.Use = "ss"
sc.RootCmd.Use = "sc"

var helpflag bool
rootCmd.SetUsageTemplate(help)
rootCmd.PersistentFlags().BoolVarP(&helpflag, "help", "h", false, "help for "+rootCmd.Use)
rootCmd.SetHelpCommand(&cobra.Command{Hidden: true})
rootCmd.PersistentFlags().MarkHidden("help") //nolint
rootCmd.CompletionOptions.DisableDefaultCmd = true
rootCmd.SetUsageTemplate(help)
RootCmd.SetUsageTemplate(help)
RootCmd.PersistentFlags().BoolVarP(&helpflag, "help", "h", false, "help for "+RootCmd.Use)
RootCmd.SetHelpCommand(&cobra.Command{Hidden: true})
RootCmd.PersistentFlags().MarkHidden("help") //nolint
RootCmd.CompletionOptions.DisableDefaultCmd = true
RootCmd.SetUsageTemplate(help)

}

var rootCmd = &cobra.Command{
// RootCmd contains skywire-visor, skywire-cli, setup-node, and the visor native apps
var RootCmd = &cobra.Command{
Use: "skywire",
Long: `
┌─┐┬┌─┬ ┬┬ ┬┬┬─┐┌─┐
Expand All @@ -64,6 +72,7 @@ var rootCmd = &cobra.Command{
Version: buildinfo.Version(),
}

// appsCmd contains the visor native apps
var appsCmd = &cobra.Command{
Use: "app",
Short: "skywire native applications",
Expand All @@ -78,34 +87,20 @@ var appsCmd = &cobra.Command{
}

func main() {
commands := []*cobra.Command{
setupnode.RootCmd,
visor.RootCmd,
skywirecli.RootCmd,
vpnserver.RootCmd,
vpnclient.RootCmd,
skysocksclient.RootCmd,
skysocks.RootCmd,
skychat.RootCmd,
appsCmd,
rootCmd,
}
for _, cmd := range commands {
cc.Init(&cc.Config{
RootCmd: cmd,
Headings: cc.HiBlue + cc.Bold,
Commands: cc.HiBlue + cc.Bold,
CmdShortDescr: cc.HiBlue,
Example: cc.HiBlue + cc.Italic,
ExecName: cc.HiBlue + cc.Bold,
Flags: cc.HiBlue + cc.Bold,
FlagsDescr: cc.HiBlue,
NoExtraNewlines: true,
NoBottomNewline: true,
})
}

if err := rootCmd.Execute(); err != nil {
cc.Init(&cc.Config{
RootCmd: RootCmd,
Headings: cc.HiBlue + cc.Bold,
Commands: cc.HiBlue + cc.Bold,
CmdShortDescr: cc.HiBlue,
Example: cc.HiBlue + cc.Italic,
ExecName: cc.HiBlue + cc.Bold,
Flags: cc.HiBlue + cc.Bold,
FlagsDescr: cc.HiBlue,
NoExtraNewlines: true,
NoBottomNewline: true,
})
if err := RootCmd.Execute(); err != nil {
fmt.Println(err)
}
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ require (

// Uncomment for tests with alternate branches of 'dmsg'
// replace github.com/skycoin/dmsg => ../dmsg
replace github.com/skycoin/dmsg => github.com/skycoin/dmsg v1.3.18-0.20240226072009-86c43e8d4ca4
replace github.com/skycoin/dmsg => github.com/skycoin/dmsg v1.3.18-0.20240306171838-3351bcc4e0ae

replace github.com/skycoin/skywire-services => github.com/skycoin/skywire-services v0.0.0-20240227141813-e2b85b1b4733
replace github.com/skycoin/skywire-services => github.com/skycoin/skywire-services v0.0.0-20240306165304-177c854f4aec

replace github.com/skycoin/skycoin-service-discovery => github.com/skycoin/skycoin-service-discovery v0.0.0-20240227140413-5cf9b81be037
replace github.com/skycoin/skycoin-service-discovery => github.com/skycoin/skycoin-service-discovery v0.0.0-20240306165129-2af10aca698e

// Uncomment for tests with alternate branches of 'skywire-utilities'
// replace github.com/skycoin/skywire-utilities => ../skywire-utilities
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,16 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skycoin/dmsg v1.3.18-0.20240226072009-86c43e8d4ca4 h1:sWspjJ1xySLaEOV2I1IZz3vyx3Fxs5fnxegR3u0mH3k=
github.com/skycoin/dmsg v1.3.18-0.20240226072009-86c43e8d4ca4/go.mod h1:INEDx+ECwCGQWw/Kd0QcLmSWMhbeRRcfkxj+xATQGFg=
github.com/skycoin/dmsg v1.3.18-0.20240306171838-3351bcc4e0ae h1:DhIVLN77m/XtWdT2dkdiRi3J7rEYUqYMNacZ+26GnpM=
github.com/skycoin/dmsg v1.3.18-0.20240306171838-3351bcc4e0ae/go.mod h1:INEDx+ECwCGQWw/Kd0QcLmSWMhbeRRcfkxj+xATQGFg=
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6 h1:1Nc5EBY6pjfw1kwW0duwyG+7WliWz5u9kgk1h5MnLuA=
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:UXghlricA7J3aRD/k7p/zBObQfmBawwCxIVPVjz2Q3o=
github.com/skycoin/skycoin v0.27.1 h1:HatxsRwVSPaV4qxH6290xPBmkH/HgiuAoY2qC+e8C9I=
github.com/skycoin/skycoin v0.27.1/go.mod h1:78nHjQzd8KG0jJJVL/j0xMmrihXi70ti63fh8vXScJw=
github.com/skycoin/skycoin-service-discovery v0.0.0-20240227140413-5cf9b81be037 h1:MHJITQuF7a9vUb/CdIVCouIvkEVtIk9pu0d3xZVuRGQ=
github.com/skycoin/skycoin-service-discovery v0.0.0-20240227140413-5cf9b81be037/go.mod h1:h2Yq97wrppNdVgtAhEhY/9w568wS3T6CkK2pWhfUQm0=
github.com/skycoin/skywire-services v0.0.0-20240227141813-e2b85b1b4733 h1:RCIRj0cU1sFcUeqyE/4YlukZu+ayZYroqqgseFqDbn4=
github.com/skycoin/skywire-services v0.0.0-20240227141813-e2b85b1b4733/go.mod h1:XHhlamCQngfgZoEBbDD1KEtfjTjPmBBmxB/tesJYk4E=
github.com/skycoin/skycoin-service-discovery v0.0.0-20240306165129-2af10aca698e h1:y9C5pGHQp/iJFj0QJqr5SboE+Q2RmeYav/AncHOAmWg=
github.com/skycoin/skycoin-service-discovery v0.0.0-20240306165129-2af10aca698e/go.mod h1:h2Yq97wrppNdVgtAhEhY/9w568wS3T6CkK2pWhfUQm0=
github.com/skycoin/skywire-services v0.0.0-20240306165304-177c854f4aec h1:yhD4TOt+5w65we9KPo9N766aWmvxnGQtnD+Dp5k2dsE=
github.com/skycoin/skywire-services v0.0.0-20240306165304-177c854f4aec/go.mod h1:wtdETGZ3hm1DBYEQ/3t5b1apF4mw3heWTZiOisSgIsE=
github.com/skycoin/skywire-utilities v1.3.18-0.20240208220612-9f31eda72f33 h1:BzhyKolEWT8cnXZJMxC0TYGCvu3wMYdI6NOpvToN+uQ=
github.com/skycoin/skywire-utilities v1.3.18-0.20240208220612-9f31eda72f33/go.mod h1:yFKWpL1bDRPKU3uK+cTF4PnYUMe+eyIj5N2bk4sF5Cw=
github.com/skycoin/systray v1.10.0 h1:fQZJHMylpVvfmOOTLvUssfyHVDoC8Idx6Ba2BlLEuGg=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions vendor/github.com/skycoin/dmsg/cmd/dmsg-server/commands/root.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading