GithubHelp home page GithubHelp logo

Flags in commands about cli HOT 6 CLOSED

urfave avatar urfave commented on July 16, 2024
Flags in commands

from cli.

Comments (6)

marksteve avatar marksteve commented on July 16, 2024

Oops. It was the flag library that was doing it. Not cli's fault.

from cli.

marksteve avatar marksteve commented on July 16, 2024

Oh. I've been up for too long. It is an issue. Flags aren't working properly with commands:

package main

import (
    "os"

    "github.com/codegangsta/cli"
)

func main() {
    app := cli.NewApp()
    app.Name = "app"
    app.Commands = []cli.Command{
        {
            Name: "command",
            Action: func(c *cli.Context) {
                println("command")
            },
            Flags: []cli.Flag{
                cli.BoolFlag{"flag,f", "just a flag"},
            },
        },
    }
    app.Run(os.Args)
}

Running this produces:

$ ./app command --flag
flag provided but not defined: -flag
Usage of command:
  -flag,f=false: just a flag
command

from cli.

codegangsta avatar codegangsta commented on July 16, 2024

hm. this does seem like a bug. I will look into it soon

from cli.

codegangsta avatar codegangsta commented on July 16, 2024

@marksteve I am not able to reproduce this on latest master of cli. By the look of that output it looks like you are running an older version that doesn't support the "flag,f" support

from cli.

marksteve avatar marksteve commented on July 16, 2024

Did a go get -u and yeah it works now. Sorry about that. I was sure that it was my first time go get-ting the library but apparently I did before. Thanks for checking it out 😄

from cli.

codegangsta avatar codegangsta commented on July 16, 2024

No problem!

On Wed, Dec 11, 2013 at 6:36 PM, Mark Steve Samson <[email protected]

wrote:

Did a go get -u and yeah it works now. Sorry about that. I was sure that
it was my first time go get-ting the library but apparently I did before.
Thanks for checking it out [image: 😄]


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-30384846
.

from cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.