Rename command line tool to signaldctl
This commit is contained in:
parent
7998e82017
commit
b112886093
12 changed files with 18 additions and 18 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
|||
/signald-cli
|
||||
/signaldctl
|
||||
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
|
|
|
@ -23,8 +23,8 @@ build:
|
|||
- cp -r * /go/src/gitlab.com/signald/signald-go
|
||||
- cd /go/src/gitlab.com/signald/signald-go
|
||||
script:
|
||||
- go build -o "${CI_PROJECT_DIR}/signald-cli" ./cmd/signald-cli
|
||||
- go build -o "${CI_PROJECT_DIR}/signaldctl" ./cmd/signaldctl
|
||||
artifacts:
|
||||
paths:
|
||||
- signald-cli
|
||||
- signaldctl
|
||||
expire_in: 1 month
|
||||
|
|
4
Makefile
4
Makefile
|
@ -1,5 +1,5 @@
|
|||
signald-cli: signald/client-protocol
|
||||
go build -o signald-cli ./cmd/signald-cli
|
||||
signaldctl: signald/client-protocol
|
||||
go build -o signaldctl ./cmd/signaldctl
|
||||
|
||||
protocol.json:
|
||||
echo '{"type": "protocol", "version": "v1alpha1"}' | nc -q0 -U /var/run/signald/signald.sock | jq 'select(.type == "protocol").data' > protocol.json
|
||||
|
|
|
@ -35,7 +35,7 @@ var linkCmd = &cobra.Command{
|
|||
Short: "Link to an existing Signal account",
|
||||
Long: `Get a URI or QR code to link to an existing Signal account`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
requestID := fmt.Sprint("signald-cli-", rand.Intn(1000))
|
||||
requestID := fmt.Sprint("signaldctl-", rand.Intn(1000))
|
||||
err := s.RawRequest(v0.LegacyRequest{
|
||||
Type: "link",
|
||||
ID: requestID,
|
|
@ -31,7 +31,7 @@ var listAccountsCmd = &cobra.Command{
|
|||
Short: "list of all the accounts registered to this signald instance.",
|
||||
Long: `Prints a list of all users to stdout.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
requestID := fmt.Sprint("signald-cli-", rand.Intn(1000))
|
||||
requestID := fmt.Sprint("signaldctl-", rand.Intn(1000))
|
||||
err := s.RawRequest(v0.LegacyRequest{
|
||||
Type: "list_accounts",
|
||||
ID: requestID,
|
|
@ -31,7 +31,7 @@ var listGroupsCmd = &cobra.Command{
|
|||
Short: "list of all the groups that the user is in.",
|
||||
Long: `Prints a list of all groups the user is in to stdout.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
requestID := fmt.Sprint("signald-cli-", rand.Intn(1000))
|
||||
requestID := fmt.Sprint("signaldctl-", rand.Intn(1000))
|
||||
err := s.RawRequest(v0.LegacyRequest{
|
||||
Type: "list_groups",
|
||||
Username: username,
|
|
@ -31,7 +31,7 @@ var registerCmd = &cobra.Command{
|
|||
Short: "Register a new account.",
|
||||
Long: `Register a new signal account, generating new keys if the number was previously registered.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
requestID := fmt.Sprint("signald-cli-", rand.Intn(1000))
|
||||
requestID := fmt.Sprint("signaldctl-", rand.Intn(1000))
|
||||
err := s.RawRequest(v0.LegacyRequest{
|
||||
Type: "register",
|
||||
Username: username,
|
||||
|
@ -48,7 +48,7 @@ var registerCmd = &cobra.Command{
|
|||
if err != nil {
|
||||
log.Fatal("error rendering response:", err)
|
||||
}
|
||||
fmt.Println("validation code requested. submit the code using signald-cli verify", string(account))
|
||||
fmt.Println("validation code requested. submit the code using signaldctl verify", string(account))
|
||||
},
|
||||
}
|
||||
|
|
@ -32,9 +32,9 @@ var s *signald.Signald
|
|||
|
||||
// RootCmd represents the base command when called without any subcommands
|
||||
var RootCmd = &cobra.Command{
|
||||
Use: "signald-cli",
|
||||
Use: "signaldctl",
|
||||
Short: "Interact with a running siangld instance",
|
||||
Long: `signald-cli is a command line tool to interact with signald.`,
|
||||
Long: `signaldctl is a command line tool to interact with signald.`,
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
s = &signald.Signald{SocketPath: socketPath}
|
||||
err := s.Connect()
|
||||
|
@ -55,7 +55,7 @@ func Execute() {
|
|||
|
||||
func init() {
|
||||
cobra.OnInitialize(initConfig)
|
||||
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.signald-cli.yaml)")
|
||||
RootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.signaldctl.yaml)")
|
||||
RootCmd.PersistentFlags().StringVarP(&socketPath, "socket", "s", "/var/run/signald/signald.sock", "the path to the signald socket file")
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,9 @@ func initConfig() {
|
|||
viper.SetConfigFile(cfgFile)
|
||||
}
|
||||
|
||||
viper.SetConfigName(".signald-cli") // name of config file (without extension)
|
||||
viper.AddConfigPath("$HOME") // adding home directory as first search path
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
viper.SetConfigName(".signaldctl") // name of config file (without extension)
|
||||
viper.AddConfigPath("$HOME") // adding home directory as first search path
|
||||
viper.AutomaticEnv() // read in environment variables that match
|
||||
|
||||
// If a config file is found, read it in.
|
||||
if err := viper.ReadInConfig(); err == nil {
|
|
@ -35,7 +35,7 @@ var verify = &cobra.Command{
|
|||
Short: "Verify an account confirmation code and complete account setup",
|
||||
Long: `Verify the phone number on a new account by submitting a verification code, completing the account registration process.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
requestID := fmt.Sprint("signald-cli-", rand.Intn(1000))
|
||||
requestID := fmt.Sprint("signaldctl-", rand.Intn(1000))
|
||||
err := s.RawRequest(v0.LegacyRequest{
|
||||
Type: "verify",
|
||||
Username: username,
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
package main
|
||||
|
||||
import "gitlab.com/signald/signald-go/cmd/signald-cli/cmd"
|
||||
import "gitlab.com/signald/signald-go/cmd/signaldctl/cmd"
|
||||
|
||||
func main() {
|
||||
cmd.Execute()
|
Loading…
Reference in a new issue