urbanjost / M_CLI2

Fortran commandline-interface using a simple prototype command
The Unlicense
20 stars 4 forks source link

Response file not working from powershell terminal #19

Open davidpfister opened 7 months ago

davidpfister commented 7 months ago

I was experimenting response file for fpm and running command like fpm @build from a powershell terminal on Windows. The issue is that @ has a special meaning in powershell and the command cannot be interpreted. It only returns the help for fpm

Fortran Package Manager:

USAGE: fpm [ SUBCOMMAND [SUBCOMMAND_OPTIONS] ]|[--list|--help|--version]
       where SUBCOMMAND is commonly new|build|run|test

 subcommand may be one of

  build     Compile the package placing results in the "build" directory
  help      Display help
  list      Display this list of subcommand descriptions
  new       Create a new Fortran package directory with sample files    
  run       Run the local package application programs
  test      Run the test programs
  update    Update and manage project dependencies
...

Workaround

sections in the rsp containing hyphens are perfectly fine, so I can run fpm @gfortran-build. Or, I can also use the classical cmd prompt.

There is probably not much to do here, but I thought I report the issue for the record in case someone faces the same problem.

lockstockandbarrel commented 5 months ago

I do not use MSWindows/powershell at all; and could not find a simple table of what characters are special in powershell. It would be easy to make some other character such as up-caret ^ or comma as an alternate for @, but I do not know if those characters are special in a powershell script. Perhaps two @ characters might work if I changed it to treat multiple @ characters as a single @?

So if the @ is single-quoted or preceded by a backslash does it work?

davidpfister commented 5 months ago

The problem with @ is splatting. And a lot of other special characters are used in powershell.

urbanjost commented 5 months ago

I see it is treated as a special character, but I have been looking for a list of characters NOT used by powershell or DOS so I could allow an alternative like ~!#% and cannot find a list of characters not used although I find different descriptions of $`~@ all having special meanings. I was just saying since @ was picked because it is commonly used for response files of different types that I could change it but I do not want to change it to another character that has different problems. From the descript it sounds like double-quoting the @word or using two at characters might work; and some possibility add --% might turn off special character proessing.It is odd to me I cannot find a list of unused characters; which shows right up for other shells like bash,tcsh,zsh, ....

On 06/16/2024 4:17 PM EDT davidpfister @.***> wrote:

The problem with @ is splatting https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.4. And a lot of other special characters are used in powershell https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-7.4.

— Reply to this email directly, view it on GitHub https://github.com/urbanjost/M_CLI2/issues/19#issuecomment-2171864640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDWN3MNAZMFJKENECTF44DZHXXFJAVCNFSM6AAAAABF7HTEWKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNZRHA3DINRUGA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

davidpfister commented 5 months ago

Powershell uses so many special characters that Microsoft probably did not bother editing an exclusion list 😄. From the top of my head, in PS the characters @, &, $, ., ..., !, ?, `, # all have a special meaning. I found this link to be quite useful. Just a thought here, but why not letting the developer specify its desired symbol? That could be a cla like --rsp-symbol=@ (default), or directly in the rsp file symbol @.