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

New remove_empty function #205

Closed
sagiegurari opened this issue Mar 17, 2019 · 3 comments
Closed

New remove_empty function #205

sagiegurari opened this issue Mar 17, 2019 · 3 comments
Assignees
Milestone

Comments

@sagiegurari
Copy link
Owner

Features Description
now that we have functions, I can add remove_empty function that will remove empty command line arguments.
for example

args = ["@@remove_empty(SOME_EMPTY_ENV_VAR)"]

if SOME_EMPTY_ENV_VAR env var is empty, that arg will be removed from the arg list.

@ssokolow
Copy link

I'm not sure how this would be useful. What does it do if SOME_EMPTY_ENV_VAR is not empty?

@sagiegurari
Copy link
Owner Author

it keeps the value.
I will give some example usage scenario:

# core file
[env]
BUILD_ALL_FEATURES_OPTION="--all-features"

[tasks.build]
description = "Runs the rust compiler."
category = "Build"
command = "cargo"
args = ["build", "@@remove-empty(BUILD_ALL_FEATURES_OPTION)"]

to turn off the all features flag in the extended file you can simply do

# extended file
[env]
BUILD_ALL_FEATURES_OPTION=""

now.... without remove-empty function, the cargo build would also get another command line argument which is an empty string that will cause it to fail.
with remove-empty, the argument is simply removed completely before invoking cargo.

@ssokolow
Copy link

By the time I read your explanation here, I'd already seen the documentation for it above the documentation you linked to for trim, but thank you for the effort involved in writing a second, different explanation.

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

No branches or pull requests

2 participants