From 68fb0f35a298aea775bef33cf0be87b5ebe1e176 Mon Sep 17 00:00:00 2001 From: Daniel Aarno Date: Tue, 26 Dec 2017 14:03:13 +0100 Subject: [PATCH] Quick fix for ZshCompletionOutput test The test was failing because elipsis changed from "..." to "... ". This is a quick and dirty fix and should be cleaned up. Also updated copyright notice # Conflicts: # tests/test85.out # tests/test85.sh --- COPYING | 2 ++ include/tclap/ZshCompletionOutput.h | 6 ++++++ tests/runtests.sh | 0 3 files changed, 8 insertions(+) mode change 100644 => 100755 tests/runtests.sh diff --git a/COPYING b/COPYING index 987be0c..d573236 100644 --- a/COPYING +++ b/COPYING @@ -1,6 +1,8 @@ Copyright (c) 2003 Michael E. Smoot +Copyright (c) 2004 Daniel Aarno +Copyright (c) 2017 Google Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/include/tclap/ZshCompletionOutput.h b/include/tclap/ZshCompletionOutput.h index d3f20f5..d2ce148 100644 --- a/include/tclap/ZshCompletionOutput.h +++ b/include/tclap/ZshCompletionOutput.h @@ -231,6 +231,12 @@ inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex) if ( a->isValueRequired() ) { std::string arg = a->shortID(); + // Example arg: "[-A ] ... " + size_t pos = arg.rfind(" ... "); + if (pos != std::string::npos) { + arg.erase(pos); + } + arg.erase(0, arg.find_last_of(theDelimiter) + 1); if ( arg.at(arg.length()-1) == ']' ) arg.erase(arg.length()-1); diff --git a/tests/runtests.sh b/tests/runtests.sh old mode 100644 new mode 100755