Giter VIP home page Giter VIP logo

Comments (5)

adrianaisemberg avatar adrianaisemberg commented on July 17, 2024

Interesting!
Currently you'll have to parse it by yourself but it's a great feature.
I'll implement.

Thanks,
Adrian

[mobile]
From: halwaxt
Sent: 6/8/2012 1:52 PM
To: Adrian Aisemberg
Subject: [CLAP] Support for Enum Flags? (#19)
First I want to thank you for your great work!

Is there a way to provide enum parameters which are defined as flags
and or'ed together?

[Flags]
enum FileType {
    Csv,
    Excel
}

[Verb]
void CreateFiles([Parameter] FileType fileType) { ... }

How to call the method with Csv and Excel enabled?

MySuperApp createfiles -filetype=Csv|Excel

Thanks in advance
Thomas


Reply to this email directly or view it on GitHub:
#19

from clap.

adrianaisemberg avatar adrianaisemberg commented on July 17, 2024

Apparently, flag enums are already supported using a comma:
MySuperApp createfiles -filetype=Csv,Excel

That's how Enum.Parse works, which is used by CLAP.

Cheers!

from clap.

adrianaisemberg avatar adrianaisemberg commented on July 17, 2024

Don't forget to set a proper flag value to each enum value:

[Flags]
enum FileType
{
Csv = 1,
Excel = 2,
...4, 8, 16 ...
}

otherwise, the compiler will set the default values, which are 0,1,2,3,... which are not real flags.

from clap.

halwaxt avatar halwaxt commented on July 17, 2024

Thanks for your help Adrian, I'll implement your suggestions as soon as possible!

Thomas

from clap.

halwaxt avatar halwaxt commented on July 17, 2024

Adrian,

works like a charm :-) Thanks a lot!

Thomas

from clap.

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.