From 8c43909094737e31ae2e3e851c10373d79788182 Mon Sep 17 00:00:00 2001 From: Marc Auberer Date: Thu, 6 Oct 2022 22:22:25 +0200 Subject: [PATCH] Spicelang patch 1 --- include/CLI/impl/Split_inl.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/include/CLI/impl/Split_inl.hpp b/include/CLI/impl/Split_inl.hpp index 7cd8e5b37..78a2256e5 100644 --- a/include/CLI/impl/Split_inl.hpp +++ b/include/CLI/impl/Split_inl.hpp @@ -26,8 +26,7 @@ namespace detail { CLI11_INLINE bool split_short(const std::string ¤t, std::string &name, std::string &rest) { if(current.size() > 1 && current[0] == '-' && valid_first_char(current[1])) { - name = current.substr(1, 1); - rest = current.substr(2); + name = current.substr(1); return true; } return false; @@ -111,12 +110,8 @@ get_names(const std::vector &input) { continue; } if(name.length() > 1 && name[0] == '-' && name[1] != '-') { - if(name.length() == 2 && valid_first_char(name[1])) - short_names.emplace_back(1, name[1]); - else if(name.length() > 2) - throw BadNameString::MissingDash(name); - else - throw BadNameString::OneCharName(name); + name = name.substr(1); + short_names.emplace_back(name); } else if(name.length() > 2 && name.substr(0, 2) == "--") { name = name.substr(2); if(valid_name_string(name))