Skip to content

Script arguments can't start with a dash #479

@DavidPerezIngeniero

Description

@DavidPerezIngeniero

I have a script that has these contents:

#!/usr/bin/env amm

@main
def ini(args: String*) = {
     ...
}

My script can't receive arguments that start with a dash, because they are taken as Ammonite arguments, instead of arguments for my script.

If I try to use e.g.

myScript.sc -?

then this is the ouput:

Error: Unknown option -?
ammonite 0.7.6
Usage: ammonite [options] [<file-args>...] [<args>...]

  -p <value> | --predef <value>
        Any commands you want to execute at the start of the REPL session
  --no-default-predef
        Disable the default predef and run Ammonite with the minimal predef possible
  <file-args>...
        The Ammonite script file you want to execute
  -c <value> | --code <value>
        Pass in code to be run immediately in the REPL
  -x | --execute
        Shim for backwards compatibility - will be removed
  <args>...
        Any arguments you want to pass to the Ammonite script file
  -h <file> | --home <file>
        The home directory of the REPL; where it looks for config and caches
  -f <value> | --predef-file <value>
        Lets you load your predef from a custom location
  -y | --continually
        Lets you run a file over and over, useful for benchmarking purposes
since it lets you hook up a profiler to the long-lived process and
see where all the time is being spent.

  -s | --silent
        Make ivy logs go silent instead of printing though failures will still throw exception
  --repl-api
        Lets you run a script with the `repl` object present; this is
normally not available in scripts and only provided in the
interactive REpl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions