mirror of
https://github.com/NixOS/nix
synced 2025-06-29 02:11:15 +02:00
Add a description in the completion outputs
Make nix output completions in the form `completion\tdescription`. This can't be used by bash (afaik), but other shells like zsh or fish can display it along the completion choices
This commit is contained in:
parent
58dadf2954
commit
04e5d0e704
6 changed files with 42 additions and 20 deletions
|
@ -283,7 +283,17 @@ typedef std::vector<std::pair<std::string, std::string>> Table2;
|
|||
|
||||
void printTable(std::ostream & out, const Table2 & table);
|
||||
|
||||
extern std::shared_ptr<std::set<std::string>> completions;
|
||||
struct Completion {
|
||||
std::string completion;
|
||||
std::string description;
|
||||
|
||||
bool operator<(const Completion & other) const;
|
||||
};
|
||||
class Completions : public std::set<Completion> {
|
||||
public:
|
||||
void add(std::string completion, std::string description = "");
|
||||
};
|
||||
extern std::shared_ptr<Completions> completions;
|
||||
extern bool pathCompletions;
|
||||
|
||||
std::optional<std::string> needsCompletion(std::string_view s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue