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

Combined output handler option #225

Closed
derks opened this Issue Jan 21, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@derks
Member

derks commented Jan 21, 2014

There may be cases where a developer may want to use an extension, for example the 'json' output handler extension which adds the '--json' command line flag, but where the developer does not want the command line option visible.

Take for instance, I want the capability to have multiple output handlers such as json, yaml, xml, html, etc. I want all these extensions enabled, but don't want all the --json, --yaml, --xml, --html options visible... I want a single --format or -f option. Such as:

$ myapp do something -f json

$ myapp do something -f xml

I'd want to wrap all the output handlers up into a single --format/-f option which would then set the app._meta.output_handler accordingly.

class MyApp(CementApp):
    class Meta:
        hide_options = ['json', 'yaml', 'xml', 'html']
   # ...

# do some kind of pre_argument_parsing, and post_argument_parsing
# hooks to add the universal format option and to set the output_handler before 
# app.run() is called.

This feature would likely be a precursor to having a built-in --format/-f or --output/-o option available, perhaps, or an example of how to do the above use case for anyone who might want it.

@ghost ghost assigned derks Jan 21, 2014

@derks

This comment has been minimized.

Show comment
Hide comment
@derks

derks Jan 21, 2014

Member

With the above in mind, could also just have a 'universal_output' extension... which would add the -o/--output option, and support all loaded output_handlers... but would still need the ability to hide the options loaded by those other extensions.

Honestly, having the builtin output option makes sense as output handlers would very commonly be mixed with multiple types of output handlers.

Member

derks commented Jan 21, 2014

With the above in mind, could also just have a 'universal_output' extension... which would add the -o/--output option, and support all loaded output_handlers... but would still need the ability to hide the options loaded by those other extensions.

Honestly, having the builtin output option makes sense as output handlers would very commonly be mixed with multiple types of output handlers.

@derks derks added dev/2.3.x and removed stable/2.2.x labels Aug 21, 2014

@derks derks assigned derks and unassigned derks Aug 21, 2014

derks added a commit that referenced this issue Aug 29, 2014

@derks derks closed this Aug 29, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment