Standalone Script Apps - Passing in page arguments issue

Standalone file - test.ss

```code
ARGV | dump
```

Calling with: web run test.ss arg1 arg2 arg3
outputs:

[
        arg1,
        arg3
]

It seems like every other argument is skipped.

Generally you’d use named args in your scripts when specifying multiple args, e.g:

web run test.ss -arg1 val1 -arg2 val2

I’ve only used ARGV when passing a single arg, but I’ll look at resolving it so it’s not treated as a named arg.

Thanks, though I tried every combo of arg passing formats and it skips every other one. If you standardize it to named variables in the future that’d be awesome.

Not sure what you mean:

$ web run test.ss -arg1 val1 -arg2 val2

sets arguments available to the script, e.g:

{{ arg1 }}, {{ arg2 }}

Outputs:

val1, val2

This should now be resolved with the latest v0.0.45 just published to NuGet which you can update with:

$ dotnet tool update -g web

Basically all script args, including -name switches should be available in ARGV collection.

I’ve also made it so you can override App Settings from script args, so you can specify to use a db with:

$ web run test.ss -db sqlserver -db.connection "Server=localhost;Initial Catalog=mydb;Integrated Security=True"
1 Like

This is truly an awesome tool. Thanks for the quick turn around.

1 Like