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

Allow passing in a custom lexer #70

Merged
merged 1 commit into from
Oct 14, 2020
Merged

Conversation

yajo
Copy link
Contributor

@yajo yajo commented Oct 5, 2020

I want to use pygments lexers when asking i.e. for YAML or JSON input.

If doing it right now, I get this error:

Traceback (most recent call last):
  File "/var/home/yajo/prodevel/copier/.venv/bin/copier", line 5, in <module>
    CopierApp.run()
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/plumbum/cli/application.py", line 577, in run
    inst, retcode = subapp.run(argv, exit=False)
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/plumbum/cli/application.py", line 572, in run
    retcode = inst.main(*tailargs)
  File "/var/home/yajo/prodevel/copier/copier/cli.py", line 38, in _wrapper
    return method(*args, **kwargs)
  File "/var/home/yajo/prodevel/copier/copier/cli.py", line 262, in main
    self.parent._copy(
  File "/var/home/yajo/prodevel/copier/copier/cli.py", line 173, in _copy
    return copy(
  File "/var/home/yajo/prodevel/copier/copier/main.py", line 135, in copy
    conf = make_config(**locals())
  File "/var/home/yajo/prodevel/copier/copier/config/factory.py", line 141, in make_config
    init_args["data_from_asking_user"] = query_user_data(
  File "/var/home/yajo/prodevel/copier/copier/config/user_data.py", line 497, in query_user_data
    return questionary.get_answers()
  File "/var/home/yajo/prodevel/copier/copier/config/user_data.py", line 360, in get_answers
    self.answers_user = prompt(
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/questionary/prompt.py", line 95, in prompt
    question = create_question_func(**_kwargs)
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/questionary/prompts/text.py", line 75, in text
    p = PromptSession(
TypeError: type object got multiple values for keyword argument 'lexer'

This should fix it.

I want to use pygments lexers when asking i.e. for YAML or JSON input.

If doing it right now, I get this error:

```
Traceback (most recent call last):
  File "/var/home/yajo/prodevel/copier/.venv/bin/copier", line 5, in <module>
    CopierApp.run()
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/plumbum/cli/application.py", line 577, in run
    inst, retcode = subapp.run(argv, exit=False)
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/plumbum/cli/application.py", line 572, in run
    retcode = inst.main(*tailargs)
  File "/var/home/yajo/prodevel/copier/copier/cli.py", line 38, in _wrapper
    return method(*args, **kwargs)
  File "/var/home/yajo/prodevel/copier/copier/cli.py", line 262, in main
    self.parent._copy(
  File "/var/home/yajo/prodevel/copier/copier/cli.py", line 173, in _copy
    return copy(
  File "/var/home/yajo/prodevel/copier/copier/main.py", line 135, in copy
    conf = make_config(**locals())
  File "/var/home/yajo/prodevel/copier/copier/config/factory.py", line 141, in make_config
    init_args["data_from_asking_user"] = query_user_data(
  File "/var/home/yajo/prodevel/copier/copier/config/user_data.py", line 497, in query_user_data
    return questionary.get_answers()
  File "/var/home/yajo/prodevel/copier/copier/config/user_data.py", line 360, in get_answers
    self.answers_user = prompt(
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/questionary/prompt.py", line 95, in prompt
    question = create_question_func(**_kwargs)
  File "/var/home/yajo/prodevel/copier/.venv/lib/python3.8/site-packages/questionary/prompts/text.py", line 75, in text
    p = PromptSession(
TypeError: type object got multiple values for keyword argument 'lexer'
```

This should fix it.
@kiancross kiancross added the Enhancement New feature or request label Oct 5, 2020
@kiancross kiancross requested a review from tmbo October 5, 2020 19:25
@yajo yajo mentioned this pull request Oct 6, 2020
6 tasks
@yajo
Copy link
Contributor Author

yajo commented Oct 12, 2020

Please could you merge this? It's blocking a release: https://github.com/copier-org/copier/runs/1241180809?check_suite_focus=true

yajo pushed a commit to copier-org/copier that referenced this pull request Oct 13, 2020
When tmbo/questionary#70 gets fixed, this commit should be rolled back.

For now, I have to remove this support because [otherwise I cannot publish Copier to Pypi](https://github.com/copier-org/copier/runs/1241180809?check_suite_focus=true).
yajo pushed a commit to copier-org/copier that referenced this pull request Oct 13, 2020
When tmbo/questionary#70 gets fixed, this commit should be rolled back.

For now, I have to remove this support because [otherwise I cannot publish Copier to Pypi](https://github.com/copier-org/copier/runs/1241180809?check_suite_focus=true).
@kiancross
Copy link
Collaborator

Looks fine to me. Waiting for @tmbo to review.

github-actions bot pushed a commit to copier-org/copier that referenced this pull request Oct 14, 2020
When tmbo/questionary#70 gets fixed, this commit should be rolled back.

For now, I have to remove this support because [otherwise I cannot publish Copier to Pypi](https://github.com/copier-org/copier/runs/1241180809?check_suite_focus=true).
Copy link
Owner

@tmbo tmbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍

@kiancross kiancross merged commit 2efc8ba into tmbo:master Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants