mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 14:02:42 +01:00
Don't insert spaces when completing attribute paths
This commit is contained in:
parent
6e6e998930
commit
1da1b2b345
6 changed files with 27 additions and 9 deletions
|
|
@ -39,7 +39,7 @@ void Completions::add(std::string completion, std::string description)
|
|||
bool Completion::operator<(const Completion & other) const
|
||||
{ return completion < other.completion || (completion == other.completion && description < other.description); }
|
||||
|
||||
bool pathCompletions = false;
|
||||
CompletionType completionType = ctNormal;
|
||||
std::shared_ptr<Completions> completions;
|
||||
|
||||
std::string completionMarker = "___COMPLETE___";
|
||||
|
|
@ -277,7 +277,7 @@ Args::Flag Args::Flag::mkHashTypeOptFlag(std::string && longName, std::optional<
|
|||
|
||||
static void _completePath(std::string_view prefix, bool onlyDirs)
|
||||
{
|
||||
pathCompletions = true;
|
||||
completionType = ctFilenames;
|
||||
glob_t globbuf;
|
||||
int flags = GLOB_NOESCAPE | GLOB_TILDE;
|
||||
#ifdef GLOB_ONLYDIR
|
||||
|
|
|
|||
|
|
@ -237,7 +237,13 @@ public:
|
|||
void add(std::string completion, std::string description = "");
|
||||
};
|
||||
extern std::shared_ptr<Completions> completions;
|
||||
extern bool pathCompletions;
|
||||
|
||||
enum CompletionType {
|
||||
ctNormal,
|
||||
ctFilenames,
|
||||
ctAttrs
|
||||
};
|
||||
extern CompletionType completionType;
|
||||
|
||||
std::optional<std::string> needsCompletion(std::string_view s);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue