Permalink
Browse files

Run gofmt

  • Loading branch information...
1 parent fc6548b commit 5f56c1f2272bc9a390b52471eccbdae22f709f13 Jesse van den Kieboom committed Sep 3, 2012
Showing with 28 additions and 30 deletions.
  1. +5 −5 convert_unix.go
  2. +2 −2 error.go
  3. +3 −3 example_test.go
  4. +0 −2 group.go
  5. +2 −2 help.go
  6. +6 −6 parser.go
  7. +10 −10 parser_private.go
View
@@ -6,17 +6,17 @@ import (
)
type winsize struct {
- ws_row, ws_col uint16
+ ws_row, ws_col uint16
ws_xpixel, ws_ypixel uint16
}
func getTerminalColumns() int {
- ws := winsize {}
+ ws := winsize{}
syscall.Syscall(syscall.SYS_IOCTL,
- uintptr(0),
- uintptr(0x5413),
- uintptr(unsafe.Pointer(&ws)))
+ uintptr(0),
+ uintptr(0x5413),
+ uintptr(unsafe.Pointer(&ws)))
return int(ws.ws_col)
}
View
@@ -39,8 +39,8 @@ func (e *Error) Error() string {
}
func newError(tp ErrorType, message string) error {
- return &Error {
- Type: tp,
+ return &Error{
+ Type: tp,
Message: message,
}
}
View
@@ -2,11 +2,11 @@
package flags_test
import (
+ "fmt"
flags "github.com/jessevdk/go-flags"
"os"
- "fmt"
- "strings"
"os/exec"
+ "strings"
)
func Example() {
@@ -26,7 +26,7 @@ func Example() {
// Note that this works just on OS X (and probably only with
// Skype) but it shows the idea.
opts.Call = func(num string) {
- cmd := exec.Command("open", "callto:" + num)
+ cmd := exec.Command("open", "callto:"+num)
cmd.Start()
cmd.Process.Release()
}
View
@@ -125,5 +125,3 @@ func NewGroup(name string, data interface{}) *Group {
ret.Error = ret.scan()
return ret
}
-
-
View
@@ -75,8 +75,8 @@ func (p *Parser) showHelpOption(writer *bufio.Writer, option *Option, maxlen int
}
writer.WriteString(wrapText(desc,
- termcol - prelen,
- strings.Repeat(" ", prelen)))
+ termcol-prelen,
+ strings.Repeat(" ", prelen)))
}
writer.WriteString("\n")
View
@@ -5,10 +5,10 @@
package flags
import (
+ "fmt"
+ "os"
"path"
"strings"
- "os"
- "fmt"
"unicode/utf8"
)
@@ -85,7 +85,7 @@ func NewNamedParser(appname string, options Options, groups ...*Group) *Parser {
return &Parser{
ApplicationName: appname,
Groups: groups,
- Options: options,
+ Options: options,
Usage: "[OPTIONS]",
}
}
@@ -129,7 +129,7 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
return ErrHelp
}
- p.Groups = append([]*Group {NewGroup("Help Options", &help)}, p.Groups...)
+ p.Groups = append([]*Group{NewGroup("Help Options", &help)}, p.Groups...)
p.Options &^= ShowHelp
}
@@ -139,7 +139,7 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
// When PassDoubleDash is set and we encounter a --, then
// simply append all the rest as arguments and break out
- if (p.Options & PassDoubleDash) != None && arg == "--" {
+ if (p.Options&PassDoubleDash) != None && arg == "--" {
ret = append(ret, args[i:]...)
break
}
@@ -200,7 +200,7 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) {
err = newError(ErrUnknown, err.Error())
}
- if (p.Options & PrintErrors) != None && err != ErrHelp {
+ if (p.Options&PrintErrors) != None && err != ErrHelp {
fmt.Fprintf(os.Stderr, "Flags error: %s\n", err.Error())
}
View
@@ -20,8 +20,8 @@ func (p *Parser) parseOption(group *Group, args []string, name string, option *O
if !option.canArgument() {
if canarg && argument != nil {
return newError(ErrNoArgumentForBool,
- fmt.Sprintf("bool flag `%s' cannot have an argument", option)),
- index
+ fmt.Sprintf("bool flag `%s' cannot have an argument", option)),
+ index
}
err = option.Set(nil)
@@ -36,16 +36,16 @@ func (p *Parser) parseOption(group *Group, args []string, name string, option *O
err = option.Set(&option.Default)
} else {
return newError(ErrExpectedArgument,
- fmt.Sprintf("expected argument for flag `%s'", option)),
+ fmt.Sprintf("expected argument for flag `%s'", option)),
index
}
if err != nil {
if _, ok := err.(*Error); !ok {
err = newError(ErrMarshal,
- fmt.Sprintf("invalid argument for flag `%s' (expected %s)",
- option,
- option.value.Type()))
+ fmt.Sprintf("invalid argument for flag `%s' (expected %s)",
+ option,
+ option.value.Type()))
}
}
@@ -60,7 +60,7 @@ func (p *Parser) parseLong(args []string, name string, argument *string, index i
}
return newError(ErrUnknownFlag,
- fmt.Sprintf("unknown flag `%s'", name)),
+ fmt.Sprintf("unknown flag `%s'", name)),
index
}
@@ -85,14 +85,14 @@ func (p *Parser) parseShort(args []string, name rune, islast bool, argument *str
if option != nil {
if option.canArgument() && !islast && !option.OptionalArgument {
return newError(ErrExpectedArgument,
- fmt.Sprintf("expected argument for flag `%s'", option)),
- index
+ fmt.Sprintf("expected argument for flag `%s'", option)),
+ index
}
return p.parseOption(grp, args, string(names), option, islast, argument, index)
}
return newError(ErrUnknownFlag,
- fmt.Sprintf("unknown flag `%s'", string(names))),
+ fmt.Sprintf("unknown flag `%s'", string(names))),
index
}

0 comments on commit 5f56c1f

Please sign in to comment.