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

cargo-make tasks DATE #865

Open
noahlin27 opened this issue Jun 8, 2023 · 5 comments
Open

cargo-make tasks DATE #865

noahlin27 opened this issue Jun 8, 2023 · 5 comments
Assignees

Comments

@noahlin27
Copy link

Feature Description

provide cargo_make_time env variable like date (and options .e.g +%Y%m%d) in bash

Describe The Solution You'd Like

Code Sample

/// paste code here
@sagiegurari
Copy link
Owner

you can run a command and put its last outline line as the value, so you can do something like:

[env]
CURRENT_DATE = { script = ["date"] }

see more at: https://github.com/sagiegurari/cargo-make#script-1

@sagiegurari
Copy link
Owner

@noahlin27 does this resolve your issue?

@sagiegurari
Copy link
Owner

closing due to lack of feedback and solution provided

@noahlin27
Copy link
Author

thanks for answering, but it would not work well on Windows.
image

btw, writing like this can help
echo %date:~0,4%-%date:~5,2%-%date:~8,2%

@sagiegurari
Copy link
Owner

@noahlin27 so you can load different env script per OS

  1. either use load_script - https://github.com/sagiegurari/cargo-make#load-scripts - which do support duckscript and you can do if is_windows and stuff like that.
  2. another option is to have a task with OS override - https://github.com/sagiegurari/cargo-make#usage-platform-override - and define the env in that task differently per OS. and have that task as a pre task for all scripts - https://github.com/sagiegurari/cargo-make#usage-init-end-tasks

@sagiegurari sagiegurari reopened this Sep 8, 2023
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