decline icon indicating copy to clipboard operation
decline copied to clipboard

Add an option to ignored undeclared options

Open goldmar opened this issue 1 year ago • 3 comments

Right now decline errors with Unexpected option whenever it is called with options that are not explicitly declared. There are cases when command-line options are used by libraries like Spark and I don't want to explicitly declare them in my application. Can we add a flag to Command.parse which would allow us to ignore undeclared options rather than error on them?

goldmar avatar Nov 07 '23 21:11 goldmar

Could you say a little more your app is set up? How is the same argument list getting passed to both Decline and Spark?

(Often the right answer in these situations is to use a '--' to separate out two distinct lists of arguments... but I'd need to know more about your situation to be sure.)

On Tue, Nov 7, 2023 at 16:05 Mark @.***> wrote:

Right now decline errors with Unexpected option whenever it is called with options that are not explicitly declared. There are cases when command-line options are using by libraries (like Spark) and I don't want to explicitly declare them in my application. Can we add a flag to Command.parse which would allow us to ignore undeclared options rather than error on them?

— Reply to this email directly, view it on GitHub https://github.com/bkirwi/decline/issues/505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFXM5ETFNHKMRHRTL5KH3YDKOPTAVCNFSM6AAAAAA7B2KALCVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4DEMRRHE2DMNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bkirwi avatar Nov 07 '23 23:11 bkirwi

Part of the complexity, FWIW, is that undeclared options are ambiguous... to parse '--foo bar' you need to know if '--foo' is an option or a flag, and for an unrecognized option you can't know which by definition!

On Tue, Nov 7, 2023 at 18:53 Ben Kirwin @.***> wrote:

Could you say a little more your app is set up? How is the same argument list getting passed to both Decline and Spark?

(Often the right answer in these situations is to use a '--' to separate out two distinct lists of arguments... but I'd need to know more about your situation to be sure.)

On Tue, Nov 7, 2023 at 16:05 Mark @.***> wrote:

Right now decline errors with Unexpected option whenever it is called with options that are not explicitly declared. There are cases when command-line options are using by libraries (like Spark) and I don't want to explicitly declare them in my application. Can we add a flag to Command.parse which would allow us to ignore undeclared options rather than error on them?

— Reply to this email directly, view it on GitHub https://github.com/bkirwi/decline/issues/505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMFXM5ETFNHKMRHRTL5KH3YDKOPTAVCNFSM6AAAAAA7B2KALCVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4DEMRRHE2DMNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bkirwi avatar Nov 08 '23 01:11 bkirwi

I see, thank you! We are using AWS Glue to run our Spark jobs and pass the configuration through Glue jobs parameters but not all of it is used in the application itself. For instance, the AWS docs mention --conf and --user-jars-first.

On a high level, we are passing a lot of parameters through Glue which are shared across jobs and I would like to avoid changing this definition or defining these options in decline.

I took a look through decline's parsing code and this change does indeed not look trivial. At the same time, I saw that other libraries support this feature (see here for scopt). For now just looking to see if you think this is a feature that would be worth supporting.

goldmar avatar Nov 08 '23 01:11 goldmar