allow updating more of the profile
This commit is contained in:
parent
3e33f0a3f7
commit
10dab5a5c9
3 changed files with 18 additions and 10 deletions
|
@ -27,10 +27,14 @@ import (
|
|||
|
||||
var (
|
||||
account string
|
||||
name string
|
||||
avatar string
|
||||
emoji string
|
||||
about string
|
||||
|
||||
SetProfileCmd = &cobra.Command{
|
||||
Use: "set-profile name",
|
||||
Short: "updates the profile data with a new name",
|
||||
Use: "set-profile [name]",
|
||||
Short: "update an account's profile data",
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
if account == "" {
|
||||
account = config.Config.DefaultAccount
|
||||
|
@ -39,16 +43,19 @@ var (
|
|||
common.Must(cmd.Help())
|
||||
log.Fatal("No account specified. Please specify with --account or set a default")
|
||||
}
|
||||
if len(args) != 1 {
|
||||
common.Must(cmd.Help())
|
||||
log.Fatal("must specify a name")
|
||||
|
||||
if len(args) > 0 {
|
||||
name = args[0]
|
||||
}
|
||||
},
|
||||
Run: func(_ *cobra.Command, args []string) {
|
||||
Run: func(_ *cobra.Command, _ []string) {
|
||||
go common.Signald.Listen(nil)
|
||||
req := v1.SetProfile{
|
||||
Account: account,
|
||||
Name: args[0],
|
||||
Name: name,
|
||||
AvatarFile: avatar,
|
||||
Emoji: emoji,
|
||||
About: about,
|
||||
}
|
||||
err := req.Submit(common.Signald)
|
||||
if err != nil {
|
||||
|
@ -61,4 +68,7 @@ var (
|
|||
|
||||
func init() {
|
||||
SetProfileCmd.Flags().StringVarP(&account, "account", "a", "", "the signald account to use")
|
||||
SetProfileCmd.Flags().StringVarP(&avatar, "avatar", "A", "", "path to avatar file")
|
||||
SetProfileCmd.Flags().StringVar(&emoji, "emoji", "", "an emoji to be shown next to the about section")
|
||||
SetProfileCmd.Flags().StringVar(&about, "about", "", "profile about section")
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
package session
|
||||
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
|
|
@ -99,7 +99,6 @@ func (s *Signald) connect() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
func (s *Signald) Close() error {
|
||||
return s.socket.Close()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue