Skip to content

Commit

Permalink
address dependency issues (#1678)
Browse files Browse the repository at this point in the history
* merge deployment binaries with skywire

* update vendor

* update go.mod & vendor with skywire-utilities and dmsg v1.3.14

* fix help menu formatting of subcommands

* include dmsgweb ; move subcommands

* remove unused variables ; make format check

* exclude testing certain files on windows

* include test of cmd/apps on windows
  • Loading branch information
0pcom authored Dec 25, 2023
1 parent d0b36f5 commit d9bcc9f
Show file tree
Hide file tree
Showing 981 changed files with 250,251 additions and 891 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ test: ## Run tests

test-windows: ## Run tests on windows
@go clean -testcache
${OPTS} go test ${TEST_OPTS} ./internal/... ./pkg/... ./cmd/...
${OPTS} go test ${TEST_OPTS} ./internal/... ./pkg/... ./cmd/skywire-cli... ./cmd/skywire-visor... ./cmd/apps...

install-linters: ## Install linters
- VERSION=latest ./ci_scripts/install-golangci-lint.sh
Expand Down
7 changes: 7 additions & 0 deletions cmd/skywire-deployment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Skywire Deployment Documentation

`../skywire/skywire.go` represents a merged binary which integrates the skywire-cli, skywire-visor, and setup-node.

The skywire-deployment includes additionally skywire deployment services, service discovery, and the full compliment of dmsg utilities

Additional documentation to be added.
207 changes: 207 additions & 0 deletions cmd/skywire-deployment/skywire.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
// cmd/skywire-deployment/skywire-deployment.go
/*
skywire deployment
*/
package main

import (
"fmt"

cc "github.com/ivanpirog/coloredcobra"
dmsgdisc "github.com/skycoin/dmsg/cmd/dmsg-discovery/commands"
dmsgserver "github.com/skycoin/dmsg/cmd/dmsg-server/commands"
dmsgcurl "github.com/skycoin/dmsg/cmd/dmsgcurl/commands"
dmsghttp "github.com/skycoin/dmsg/cmd/dmsghttp/commands"
dmsgptycli "github.com/skycoin/dmsg/cmd/dmsgpty-cli/commands"
dmsgptyhost "github.com/skycoin/dmsg/cmd/dmsgpty-host/commands"
dmsgptyui "github.com/skycoin/dmsg/cmd/dmsgpty-ui/commands"
dmsgweb "github.com/skycoin/dmsg/cmd/dmsgweb/commands"
sd "github.com/skycoin/skycoin-service-discovery/cmd/service-discovery/commands"
"github.com/spf13/cobra"

ar "github.com/skycoin/skywire-services/cmd/address-resolver/commands"
confbs "github.com/skycoin/skywire-services/cmd/config-bootstrapper/commands"
dmsgm "github.com/skycoin/skywire-services/cmd/dmsg-monitor/commands"
kg "github.com/skycoin/skywire-services/cmd/keys-gen/commands"
lc "github.com/skycoin/skywire-services/cmd/liveness-checker/commands"
nv "github.com/skycoin/skywire-services/cmd/node-visualizer/commands"
pvm "github.com/skycoin/skywire-services/cmd/public-visor-monitor/commands"
rf "github.com/skycoin/skywire-services/cmd/route-finder/commands"
se "github.com/skycoin/skywire-services/cmd/sw-env/commands"
tpdm "github.com/skycoin/skywire-services/cmd/tpd-monitor/commands"
tpd "github.com/skycoin/skywire-services/cmd/transport-discovery/commands"
tps "github.com/skycoin/skywire-services/cmd/transport-setup/commands"
"github.com/skycoin/skywire-utilities/pkg/buildinfo"
setupnode "github.com/skycoin/skywire/cmd/setup-node/commands"
skywirecli "github.com/skycoin/skywire/cmd/skywire-cli/commands"
"github.com/skycoin/skywire/pkg/visor"
)

func init() {
dmsgptyCmd.AddCommand(
dmsgptycli.RootCmd,
dmsgptyhost.RootCmd,
dmsgptyui.RootCmd,
)
dmsgCmd.AddCommand(
dmsgptyCmd,
dmsgdisc.RootCmd,
dmsgserver.RootCmd,
dmsgm.RootCmd,
dmsghttp.RootCmd,
dmsgcurl.RootCmd,
dmsgweb.RootCmd,
)
svcCmd.AddCommand(
setupnode.RootCmd,
tpd.RootCmd,
tps.RootCmd,
tpdm.RootCmd,
ar.RootCmd,
rf.RootCmd,
confbs.RootCmd,
kg.RootCmd,
lc.RootCmd,
nv.RootCmd,
pvm.RootCmd,
se.RootCmd,
sd.RootCmd,
)
rootCmd.AddCommand(
visor.RootCmd,
skywirecli.RootCmd,
svcCmd,
dmsgCmd,
)
visor.RootCmd.Long = `
┌─┐┬┌─┬ ┬┬ ┬┬┬─┐┌─┐ ┬ ┬┬┌─┐┌─┐┬─┐
└─┐├┴┐└┬┘││││├┬┘├┤───└┐┌┘│└─┐│ │├┬┘
└─┘┴ ┴ ┴ └┴┘┴┴└─└─┘ └┘ ┴└─┘└─┘┴└─`
dmsgcurl.RootCmd.Use = "curl"
dmsgweb.RootCmd.Use = "web"
setupnode.RootCmd.Use = "sn"

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)

}

var rootCmd = &cobra.Command{
Use: "skywire",
Long: `
┌─┐┬┌─┬ ┬┬ ┬┬┬─┐┌─┐
└─┐├┴┐└┬┘││││├┬┘├┤
└─┘┴ ┴ ┴ └┴┘┴┴└─└─┘`,
SilenceErrors: true,
SilenceUsage: true,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),
}

// RootCmd contains all subcommands
var svcCmd = &cobra.Command{
Use: "svc",
Short: "Skywire services",
Long: `
┌─┐┬┌─┬ ┬┬ ┬┬┬─┐┌─┐ ┌─┐┌─┐┬─┐┬ ┬┬┌─┐┌─┐┌─┐
└─┐├┴┐└┬┘││││├┬┘├┤───└─┐├┤ ├┬┘└┐┌┘││ ├┤ └─┐
└─┘┴ ┴ ┴ └┴┘┴┴└─└─┘ └─┘└─┘┴└─ └┘ ┴└─┘└─┘└─┘`,
SilenceErrors: true,
SilenceUsage: true,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
Version: buildinfo.Version(),
}

// RootCmd contains all binaries which may be separately compiled as subcommands
var dmsgCmd = &cobra.Command{
Use: "dmsg",
Short: "Dmsg services & utilities",
Long: `
┌┬┐┌┬┐┌─┐┌─┐
│││││└─┐│ ┬
─┴┘┴ ┴└─┘└─┘ `,
SilenceErrors: true,
SilenceUsage: true,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
}

var dmsgptyCmd = &cobra.Command{
Use: "pty",
Short: "Dmsg pseudoterminal (pty)",
Long: `
┌─┐┌┬┐┬ ┬
├─┘ │ └┬┘
┴ ┴ ┴ `,
SilenceErrors: true,
SilenceUsage: true,
DisableSuggestions: true,
DisableFlagsInUseLine: true,
}

func main() {
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,
tpdm.RootCmd,
ar.RootCmd,
rf.RootCmd,
confbs.RootCmd,
kg.RootCmd,
lc.RootCmd,
nv.RootCmd,
pvm.RootCmd,
se.RootCmd,
dmsgm.RootCmd,
sd.RootCmd,
svcCmd,
setupnode.RootCmd,
visor.RootCmd,
skywirecli.RootCmd,
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 {
fmt.Println(err)
}
}

const help = "{{if gt (len .Aliases) 0}}" +
"{{.NameAndAliases}}{{end}}{{if .HasAvailableSubCommands}}" +
"Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand)}}\r\n " +
"{{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}\r\n\r\n" +
"Flags:\r\n" +
"{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}\r\n\r\n" +
"Global Flags:\r\n" +
"{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}\r\n\r\n"
Loading

0 comments on commit d9bcc9f

Please sign in to comment.