-
Notifications
You must be signed in to change notification settings - Fork 132
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
How to use scripts and arguments? #634
Comments
when you do 'pwd' at first line of your script, what do you see? |
@janosimas can you please respond? |
I did some tests to give more information, here is what I would like to do: [tasks.run_file]
description = "Some script"
cwd = "script_folder/"
script = { file = "my_script.sh" }
args = [
"arg1"
] What I want: What is happening:
Why do you create a temp script when using |
so, if it is invoked in the right directory, i'm not 100% sure what the issue you are facing exactly.
The original implementation had script content embedded inside the makefile. |
Just to clarify, I already have a script that I cannot modify and I'd like to use it. This script tries to identify where it is located, using Would it be possible to, instead of loading the content, create a generic script with your boilerplate code that calls the original script without modifying it? |
I prefer not to since i moved the entire code to a separate crate and it would require me to duplicate the logic. [tasks.run_file]
description = "Some script"
cwd = "script_folder/"
script = '''
. ./myscript.sh
'''
args = [
"arg1"
] for this specific script? basically instead of: |
Sorry for the time taken. I understand the limitation and the particularities of I'm using
Defining the execution shell as
|
On the args subject, it doesn't seam to work correctly with scripts. Here is an example:
This will not print External args work as expected, e.g. The behavior for commands is great and accepts both inputs:
|
that is not how it works. args for scripts are the cli args you gave cargo-make, and those are sent to the scripts. see more at: |
I expected it to work the same way, the use case is simply consistency. If |
i'm asking because why would you do script = '''echo $1'''
args = ['test'] and not directly script = '''echo test''' whats the use case for that (apart of consistency)? Currently, the only failure i give is if 2 actions were defined (for example both command and script or run_task) and warnings in case of unknown attributes (happens if you do spelling mistake for example and write comand instead of command), or using deprecated attributes/tasks. |
For me, the consistency is relevant specially when you're maintaining a makefile. When you have a script that works like a command,
I'll take a look at the code but I'm not sure when I would be able to make a PR. |
I was doing some tests and I got some results that I believe can be improved.
When a script is used, the script is copied (?) to a temp file and the temp file is executed.
The execution doesn't seam to respect the
cwd
nor theargs
attributes.The text was updated successfully, but these errors were encountered: