diff options
| author | Maxime Coste <mawww@kakoune.org> | 2018-05-30 23:23:38 +1000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2018-07-05 07:54:28 +1000 |
| commit | b548dd3a6f369e5a244fdcdca55061513026f82a (patch) | |
| tree | 1ca672c1d6f976a74f34d37f75fd68a83933fbe1 /src/parameters_parser.hh | |
| parent | 5eeec8bd4d24882ea443c4441f696257b8cb68c4 (diff) | |
Change option lists to be specified as separate arguments on commands line
Option lists and maps are specified using separate arguments, avoiding
the need for additional escaping of their separator and reusing the
existing command line spliting logic instead.
As discussed on #2087, this should make it much easier to work with
list options, and make the general option system feel cleaner.
Diffstat (limited to 'src/parameters_parser.hh')
| -rw-r--r-- | src/parameters_parser.hh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parameters_parser.hh b/src/parameters_parser.hh index 8cbaf0fd..0f9f83dc 100644 --- a/src/parameters_parser.hh +++ b/src/parameters_parser.hh @@ -6,6 +6,7 @@ #include "meta.hh" #include "array_view.hh" #include "optional.hh" +#include "flags.hh" #include "string.hh" #include "string_utils.hh" @@ -115,6 +116,12 @@ struct ParametersParser return m_params[m_positional_indices[index]]; } + ConstArrayView<String> positionals_from(size_t first) const + { + kak_assert(m_desc.flags & (ParameterDesc::Flags::SwitchesOnlyAtStart | ParameterDesc::Flags::SwitchesAsPositional)); + return m_params.subrange(m_positional_indices[first]); + } + iterator begin() const { return iterator(*this, 0); } iterator end() const { return iterator(*this, m_positional_indices.size()); } |
