pub fn parse_file<P>(
file: Option<P>,
max_size: Option<u64>,
) -> Result<Option<Args>>Expand description
§Parses from file
§Rules
§Default file
- Default file is a file named
DIA_ARGS_FILE_NAMEwithin 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.[1] - If
Noneis given, default file will be used. - If the file does not exist,
Noneis returned.
§Limits and syntax
-
If
max_sizeis zero, an error is returned. IfNone,MAX_DIA_ARGS_FILE_SIZEwill be used. If the file’s size is larger than provided value, an error is 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 itThey’re all the same. Also, note that values will be trimmed.
^^In theory, that is the goal. Howeverenv::current_exe()function might return the original file (not the symlink). In that case, the parent directory of the original file will be used.