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

Add "--config" option to plonecli "create" and "add" commands #80

Closed
me-kell opened this issue Aug 11, 2022 · 3 comments · Fixed by #81
Closed

Add "--config" option to plonecli "create" and "add" commands #80

me-kell opened this issue Aug 11, 2022 · 3 comments · Fixed by #81

Comments

@me-kell
Copy link

me-kell commented Aug 11, 2022

It would be very helpful if plonecli could accept a configuration file to specify mr.bob variables.

This could be easily be done in the functions create and add in plonecli.cli.py by adding a click.option and extending the list passed to mrbobmain as follows:

def create(context, template, name):

...
@click.option("-c", "--config", default=None, help="Configuration file to specify either [mr.bob] or [variables] sections.")
...
def create(context, template, name, config):
    ...
    mrbob_args = [bobtemplate, "-O", name]
    if config is not None:
        mrbob_args.extend(["-c", config])
    mrbobmain(mrbob_args)

def add(context, template):

@click.option("-c", "--config", default=None, help="Configuration file to specify either [mr.bob] or [variables] sections.")
...
def add(context, template, config):
    ...
    mrbob_args = [bobtemplate]
    if config is not None:
        mrbob_args.extend(["-c", config])
    mrbobmain(mrbob_args)
@MrTango
Copy link
Contributor

MrTango commented Sep 5, 2022

You can set these variables in your home in:

$ cat ~/.mrbob 
[mr.bob]
verbose = False

[variables]
# all variables answered here, will not being ask again:

author.name = Maik Derstappen
author.email = [email protected]
author.github.user = MrTango
package.venv.disabled = n
package.git.disabled = n
package.git.init = y
package.git.autocommit = y

[defaults]
# set your default values for questions here, they questions are still being ask
# but with your defaults:

plone.version = 5.2.5
#dexterity_type_global_allow = n
#dexterity_type_filter_content_types = y
#dexterity_type_activate_default_behaviors = n
#dexterity_type_supermodel = y
python.version = /home/maik/.pyenv/versions/3.8.11/bin/python3.8

the existing config command is generating this config for you after asking some questions.

What would the purpose of additional configuration be?

@me-kell
Copy link
Author

me-kell commented Sep 6, 2022

@MrTango "What would the purpose of additional configuration be?"
The purpose would be to pass the a config file to mrbob --config.

IMHO there is no need to obfuscate mrbob's config option.

When creating several different templates with mrbob setting the variables in ~/.mrbob is not optimal.
Using specific config files is reusable, reproducible and allows adding those config files to a version control system.

@erral
Copy link
Member

erral commented Nov 1, 2022

We also need this to be able to call plonecli through cookiecutter-plone-starter see collective/cookiecutter-plone-starter#25

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

Successfully merging a pull request may close this issue.

3 participants