-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcmd_get.go
49 lines (41 loc) · 1.36 KB
/
cmd_get.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
////////////////////////////////////////////////////////////////////////////
// Program: wireframe
// Purpose: wire framing
// Authors: Myself <[email protected]> (c) 2018, All rights reserved
////////////////////////////////////////////////////////////////////////////
package main
import (
"fmt"
"io"
"os"
"strings"
"github.com/mkideal/cli"
"github.com/mkideal/cli/clis"
)
////////////////////////////////////////////////////////////////////////////
// get
func getCLI(ctx *cli.Context) error {
rootArgv = ctx.RootArgv().(*rootT)
argv := ctx.Argv().(*getT)
clis.Setup(fmt.Sprintf("%s::%s", progname, ctx.Path()), rootArgv.Verbose.Value())
clis.Verbose(2, "<%s> -\n %+v\n %+v\n %v\n", ctx.Path(), rootArgv, argv, ctx.Args())
Opts.Self, Opts.Host, Opts.Port, Opts.Daemonize, Opts.Verbose =
rootArgv.Self, rootArgv.Host, rootArgv.Port, rootArgv.Daemonize, rootArgv.Verbose.Value()
if !ctx.IsSet("--output") {
fileo, err := os.Create(
strings.Replace(argv.Filei.Name(), ".org", ".new", 1))
clis.AbortOn("Output file create", err)
argv.Fileo.SetWriter(fileo)
}
fileo := argv.Fileo
clis.Verbose(2, "] %s\n", fileo.Name())
defer fileo.Close()
return DoGet(fileo)
}
//
func DoGet(w io.Writer) error {
fmt.Printf("%s v %s. Get from the service\n", progname, version)
fmt.Println("Copyright (C) 2018, Myself <[email protected]>")
fmt.Fprintf(w, "Someting\n")
return nil
}