24 lines
612 B
C++
24 lines
612 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "CommandSpec.h"
|
|
#include "Completion.h"
|
|
#include "Database.h"
|
|
|
|
// Works out tab-completion candidates for the text typed so far: command
|
|
// words first, then arguments (task names, account names, statuses, ...).
|
|
class Completer {
|
|
public:
|
|
Completer(const Database& db, const std::vector<CommandSpec>& specs);
|
|
|
|
Completion complete(const std::string& textBeforeCursor) const;
|
|
|
|
private:
|
|
std::vector<std::string> valuesFor(ArgKind kind, const std::string& current) const;
|
|
|
|
const Database& db_;
|
|
const std::vector<CommandSpec>& specs_;
|
|
};
|