Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can we declare consuming variadic arguments including - prefixed one in OptionsType #59

Closed
norio-nomura opened this issue Feb 29, 2016 · 3 comments

Comments

@norio-nomura
Copy link
Contributor

jpsim/SourceKitten#174
Maybe that issue introduced since updating Commandant to the version that supports generating Unrecognized arguments error.

For fixing that, I tried:

    static func evaluate(m: CommandMode) -> Result<DocOptions, CommandantError<SourceKittenError>> {
        return create
            <*> m <| Option(key: "single-file", defaultValue: false, usage: "only document one file")
            <*> m <| Option(key: "module-name", defaultValue: "",    usage: "name of module to document (can't be used with `--single-file` or `--objc`)")
            <*> m <| Option(key: "objc",        defaultValue: false, usage: "document Objective-C headers")
            <*> m <| Argument(defaultValue: [], usage: "An argument list that consumes the rest of positional arguments")
    }

and got:

% cd Source/SourceKittenFrameworkTests/Fixtures
% sourcekitten doc --single-file Subscript.swift -j4 Subscript.swift
Unrecognized arguments: -j4

-j4 Subscript.swift are expected to use as arguments on launching child process.

@norio-nomura
Copy link
Contributor Author

The child process is xcodebuild and may take another - prefixed arguments.

@mdiep
Copy link
Member

mdiep commented Feb 29, 2016

We should probably support -- to explicitly end named arguments.

@norio-nomura
Copy link
Contributor Author

Oh, -- works!
Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants