Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LinkAccountCmd = &cobra.Command{ Use: "link", Short: "create a local account by linking to an existing Signal account", Run: func(_ *cobra.Command, _ []string) { go common.Signald.Listen(nil) req := v1.GenerateLinkingURIRequest{} if testing { req.Server = signald.StagingServerUUID } response, err := req.Submit(common.Signald) if err != nil { log.Fatal(err) } switch common.OutputFormat { case common.OutputFormatJSON: err := json.NewEncoder(os.Stdout).Encode(response.Uri) if err != nil { log.Fatal(err, "error encoding response to stdout") } case common.OutputFormatYAML: err := yaml.NewEncoder(os.Stdout).Encode(response.Uri) if err != nil { log.Fatal(err, "error encoding response to stdout") } case common.OutputFormatCSV, common.OutputFormatTable: t := table.NewWriter() t.SetOutputMirror(os.Stdout) t.AppendHeader(table.Row{"URI"}) t.AppendRow(table.Row{response.Uri}) if common.OutputFormat == common.OutputFormatCSV { t.RenderCSV() } else { common.StylizeTable(t) t.Render() } case common.OutputFormatQR, common.OutputFormatDefault: qrterminal.Generate(response.Uri, qrterminal.M, os.Stdout) default: log.Fatal("unsupported output format") } finishReq := v1.FinishLinkRequest{ DeviceName: deviceName, SessionId: response.SessionId, Overwrite: overwrite, } _, err = finishReq.Submit(common.Signald) if err != nil { log.Fatal(err) } log.Println("linking successful") }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.