[][src]Function dia_args::parse_file

pub fn parse_file<P>(file: Option<P>) -> Result<Args> where
    P: AsRef<Path>, 

Parses from file

Rules

Default file

  • Default file is a file named DIA_ARGS_FILE_NAME within directory of the program. On Unix, if the program is a symlink, its parent directory is used. The parent directory of the original file is not used.
  • If None is given, default file will be used.
  • If input file is resolved as default file, and it does not exist, an empty Args will be returned.

Limits and syntax

  • An error will be returned if the file's size is larger than MAX_DIA_ARGS_FILE_SIZE.

  • On Unix, the file's permissions must be equal to, or more restrictive than the program's owners'. Or an error will be returned.

  • Empty lines or lines starting with # will be ignored.

  • Each command, argument, or option must be placed on a separate line.

  • Normally, a shell will remove leading/trailing marks such as "..." or '...'. However those are not required in this file. So you can separate options like these:

    --passphrase=secret passphrase with white-spaces in it
    --passphrase        =       secret passphrase with white-spaces in it
    --passphrase        secret passphrase with white-spaces in it
    

    They're all the same. Also, note that values will be trimmed.