Unexpected parameter(s) error with ${staged} variable
See original GitHub issueVersion
v0.5.4
Details
I want format my code with only staged files, so i test the ${staged} variable with an c# script for this.
If i change ${staged}
to some hardcoded values e.g. "arg1"
it works as expected.
When i run husky i got following errors:
Unexpected parameter(s):
<.husky/test.csx>
Husky v0.5.4
USAGE
husky exec <path> [options]
DESCRIPTION
Execute a csharp script (.csx) file
PARAMETERS
* path The script file to execute
-a|--args Arguments to pass to the script Default: .
--no-cache Disable caching Default: "False".
--no-color Disable color output Default: "False".
-v|--verbose Enable verbose output Default: "False".
-h|--help Shows help text.
? Task 'exec-test' failed in 286ms
A simple echo task works fine but every arg to another command won’t.
✔️
{
"command": "cmd",
"args": [
"/c",
"echo",
"${staged}"
]
},
❌
{
"name": "Run dotnet format",
"command": "dotnet",
"args": [
"format",
"--files",
"${staged}"
],
"include": [
"**/*.cs"
]
},
Steps to reproduce
- Create c# test script in
.husky/test.csx
to print the args
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("Test: {0}", string.Join(",", Args));
return 1;
- Create a task step in
.husky/task-runner.json
{
"tasks": [
{
"name": "exec-test",
"command": "dotnet",
"args": [
"husky",
"exec",
".husky/test.csx",
"--args",
"${staged}"
]
}
]
}
- Run it
dotnet husky run
Issue Analytics
- State:
- Created 4 months ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Azure Pipelines YAML: Unexpected value 'variables' and ...
The jobs element doesn't support variables , job/stage support it instead. Moving the variables to correct scope would resolve this issue.
Read more >unexpected value stages/variables error?? · Issue #12380
Hello, I have been figuring out this error for days but not sure why. I want to set up a global variable that...
Read more >Can you not have parameters and variables in the same ...
Hi, according to this GitHub issue, it seems that we can't use parameters and variables in the same template. You can define variable...
Read more >Setting output variable when multiple stages share a job ...
Setting output variable when multiple stages share a job results in unexpected sharing - Developer Community.
Read more >Variable groups in azure pipeline templates don't work
I have a sample template pipeline like the below. parameters: npmPublishFeed: "test" variables: - group: "AzureDevopsAccessToken" stages: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry for the unnecessary disturbance! I don’t know the root causes but seems to be that my company PC is to hard restricted. It work’s on my private PC as expected.
It might be related the terminal you are using, can you try PowerShell if you’re using something else? it should work for you. I tested on two different machines with two different OS, didn’t face this problem