Elixir语言中 OptionParser.parse_head
相关用法介绍如下。
用法:
parse_head(argv, opts \\ [])
@spec parse_head(argv(), options()) :: {parsed(), argv(), errors()}
类似于
但只解析 parse/2
argv
的头部;一旦找到非开关,它就会停止解析。
有关详细信息,请参阅
。parse/2
示例
iex> OptionParser.parse_head(
...> ["--source", "lib", "test/enum_test.exs", "--verbose"],
...> switches: [source: :string, verbose: :boolean]
...> )
{[source: "lib"], ["test/enum_test.exs", "--verbose"], []}
iex> OptionParser.parse_head(
...> ["--verbose", "--source", "lib", "test/enum_test.exs", "--unlock"],
...> switches: [source: :string, verbose: :boolean, unlock: :boolean]
...> )
{[verbose: true, source: "lib"], ["test/enum_test.exs", "--unlock"], []}
相关用法
- Elixir OptionParser.parse_head!用法及代码示例
- Elixir OptionParser.parse!用法及代码示例
- Elixir OptionParser.parse用法及代码示例
- Elixir OptionParser.to_argv用法及代码示例
- Elixir OptionParser.split用法及代码示例
- Elixir OptionParser用法及代码示例
- Elixir StringIO.flush用法及代码示例
- Elixir Calendar.ISO.date_to_string用法及代码示例
- Elixir Enum.unzip用法及代码示例
- Elixir Date.add用法及代码示例
- Elixir Keyword.get用法及代码示例
- Elixir Stream用法及代码示例
- Elixir Registry.count_match用法及代码示例
- Elixir List.keyfind!用法及代码示例
- Elixir URI.decode用法及代码示例
- Elixir Integer.pow用法及代码示例
- Elixir NaiveDateTime用法及代码示例
- Elixir Enum.min_max用法及代码示例
- Elixir Path.basename用法及代码示例
- Elixir Code.prepend_path用法及代码示例
- Elixir Calendar.ISO.time_to_string用法及代码示例
- Elixir Bitwise.~~~expr用法及代码示例
- Elixir Kernel.SpecialForms.case用法及代码示例
- Elixir String.contains?用法及代码示例
- Elixir Map.keys用法及代码示例
注:本文由纯净天空筛选整理自elixir-lang.org大神的英文原创作品 OptionParser.parse_head(argv, opts \\ [])。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。