Ver a proveniência

Move --tor flag checking to options.go

pull/20/head
Matt Baer há 5 anos
ascendente
cometimento
d6c9ede87c
3 ficheiros alterados com 8 adições e 4 eliminações
  1. +1
    -1
      cmd/writeas/cli.go
  2. +3
    -3
      cmd/writeas/commands.go
  3. +4
    -0
      cmd/writeas/options.go

+ 1
- 1
cmd/writeas/cli.go Ver ficheiro

@@ -247,7 +247,7 @@ func readStdIn() []byte {
}

func handlePost(fullPost []byte, c *cli.Context) error {
tor := c.Bool("tor") || c.Bool("t")
tor := isTor(c)
if c.Int("tor-port") != 0 {
torPort = c.Int("tor-port")
}


+ 3
- 3
cmd/writeas/commands.go Ver ficheiro

@@ -59,7 +59,7 @@ func cmdDelete(c *cli.Context) error {
}
}

tor := c.Bool("tor") || c.Bool("t")
tor := isTor(c)
if c.Int("tor-port") != 0 {
torPort = c.Int("tor-port")
}
@@ -91,7 +91,7 @@ func cmdUpdate(c *cli.Context) error {
// Read post body
fullPost := readStdIn()

tor := c.Bool("tor") || c.Bool("t")
tor := isTor(c)
if c.Int("tor-port") != 0 {
torPort = c.Int("tor-port")
}
@@ -110,7 +110,7 @@ func cmdGet(c *cli.Context) error {
return cli.NewExitError("usage: writeas get <postId>", 1)
}

tor := c.Bool("tor") || c.Bool("t")
tor := isTor(c)
if c.Int("tor-port") != 0 {
torPort = c.Int("tor-port")
}


+ 4
- 0
cmd/writeas/options.go Ver ficheiro

@@ -11,3 +11,7 @@ func userAgent(c *cli.Context) string {
}
return ua + " (" + defaultUserAgent + ")"
}

func isTor(c *cli.Context) bool {
return c.Bool("tor") || c.Bool("t")
}

Carregando…
Cancelar
Guardar