-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure cmd/skywire-services (#79)
* restructure skywire-services command * restructure skywire-services command * update dependency graph * make format
- Loading branch information
Showing
6 changed files
with
586 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Package commands cmd/skywire-services/commands/services.go | ||
package commands | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
|
||
"github.com/skycoin/skywire-utilities/pkg/buildinfo" | ||
"github.com/spf13/cobra" | ||
|
||
ar "github.com/skycoin/skywire-services/cmd/address-resolver/commands" | ||
confbs "github.com/skycoin/skywire-services/cmd/config-bootstrapper/commands" | ||
kg "github.com/skycoin/skywire-services/cmd/keys-gen/commands" | ||
nv "github.com/skycoin/skywire-services/cmd/node-visualizer/commands" | ||
rf "github.com/skycoin/skywire-services/cmd/route-finder/commands" | ||
se "github.com/skycoin/skywire-services/cmd/sw-env/commands" | ||
tpd "github.com/skycoin/skywire-services/cmd/transport-discovery/commands" | ||
tps "github.com/skycoin/skywire-services/cmd/transport-setup/commands" | ||
ut "github.com/skycoin/skywire-services/cmd/uptime-tracker/commands" | ||
) | ||
|
||
func init() { | ||
RootCmd.AddCommand( | ||
tpd.RootCmd, | ||
tps.RootCmd, | ||
ar.RootCmd, | ||
rf.RootCmd, | ||
confbs.RootCmd, | ||
kg.RootCmd, | ||
nv.RootCmd, | ||
se.RootCmd, | ||
ut.RootCmd, | ||
) | ||
tpd.RootCmd.Use = "tpd" | ||
tps.RootCmd.Use = "tps" | ||
ar.RootCmd.Use = "ar" | ||
rf.RootCmd.Use = "rf" | ||
confbs.RootCmd.Use = "confbs" | ||
kg.RootCmd.Use = "kg" | ||
nv.RootCmd.Use = "nv" | ||
se.RootCmd.Use = "se" | ||
ut.RootCmd.Use = "ut" | ||
} | ||
|
||
// RootCmd contains all subcommands | ||
var RootCmd = &cobra.Command{ | ||
Use: func() string { | ||
return strings.Split(filepath.Base(strings.ReplaceAll(strings.ReplaceAll(fmt.Sprintf("%v", os.Args), "[", ""), "]", "")), " ")[0] | ||
}(), | ||
Short: "Skywire services", | ||
Long: ` | ||
┌─┐┬┌─┬ ┬┬ ┬┬┬─┐┌─┐ ┌─┐┌─┐┬─┐┬ ┬┬┌─┐┌─┐┌─┐ | ||
└─┐├┴┐└┬┘││││├┬┘├┤───└─┐├┤ ├┬┘└┐┌┘││ ├┤ └─┐ | ||
└─┘┴ ┴ ┴ └┴┘┴┴└─└─┘ └─┘└─┘┴└─ └┘ ┴└─┘└─┘└─┘ | ||
Skywire services`, | ||
SilenceErrors: true, | ||
SilenceUsage: true, | ||
DisableSuggestions: true, | ||
DisableFlagsInUseLine: true, | ||
Version: buildinfo.Version(), | ||
} | ||
|
||
// Execute executes root CLI command. | ||
func Execute() { | ||
if err := RootCmd.Execute(); err != nil { | ||
log.Fatal("Failed to execute command: ", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.