diff --git a/lib/base/clicommand.cpp b/lib/base/clicommand.cpp index a2aed63f2..0a5062d9b 100644 --- a/lib/base/clicommand.cpp +++ b/lib/base/clicommand.cpp @@ -81,7 +81,7 @@ std::vector icinga::GetFieldCompletionSuggestions(const Type *type, cons String fname = field.Name; - if (fname == "__name" || fname == "templates") + if (fname == "__name" || fname == "templates" || fname == "type") continue; String suggestion = fname + "="; diff --git a/lib/cli/repositoryobjectcommand.cpp b/lib/cli/repositoryobjectcommand.cpp index 7b19d0fd8..074ba82e7 100644 --- a/lib/cli/repositoryobjectcommand.cpp +++ b/lib/cli/repositoryobjectcommand.cpp @@ -111,9 +111,12 @@ void RepositoryObjectCommand::InitParameters(boost::program_options::options_des std::vector RepositoryObjectCommand::GetPositionalSuggestions(const String& word) const { - const Type *ptype = Type::GetByName(m_Type); - ASSERT(ptype); - return GetFieldCompletionSuggestions(ptype, word); + if (m_Command == RepositoryCommandAdd) { + const Type *ptype = Type::GetByName(m_Type); + ASSERT(ptype); + return GetFieldCompletionSuggestions(ptype, word); + } else + return CLICommand::GetPositionalSuggestions(word); } /**