question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Passing boolean values as CLI arguments

See original GitHub issue

How can I pass a boolean value as a command line argument to copier? I’m doing it as given below: -d 'notification=False'

However, in the template, the following line does not detect notification as being False, but works when I compare it to the string False. [% if notification -%]

Not sure if this is a bug or I’m missing something.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yajocommented, Jun 28, 2021

I think you forgot to set type: bool to the notification question. Please reopen otherwise and provide your copier.yaml. Thanks!

0reactions
yajocommented, Jun 30, 2021

Well, as long as the problem’s fixed, I wouldn’t worry much about that 😄

The use case of providing answers without declaring questions is always gonna produce some corner cases, as it’s not our main use case focus.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can you pass boolean values as command line arguments?
#1 ChaosNicro. Hello there, I am trying to write a program that is supposed to take boolean type values as arguments. When all...
Read more >
c# - Command Line Parser Library - Boolean Parameter
I try to pass a boolean parameter to a console application and process the value with the Command Line Parser Library.
Read more >
boolean arguments always get true value · Issue #290 - GitHub
Booleans do not take arguments. They are flags, so including the boolean flag means 'true' and leaving it out means 'false'.
Read more >
Parse Over Boolean Values in Command-Line Arguments in ...
Learn how to parse over boolean values in command-line arguments using Python.
Read more >
Setting boolean variables from the command line
Pass in 0 or 1 for the respective boolean values. You can test this out by using the Should be True keyword.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found