teditor
1.8.0@@fee5e94
Terminal based editor written in C++
|
Go to the documentation of this file.
5 #include <unordered_map>
11 bool isDir(
const std::string& f);
12 bool isFile(
const std::string& f);
14 void makeDir(
const std::string& d);
20 Remote(
const std::string& f);
25 std::string
slurp(
const std::string& file);
29 bool isAbs(
const std::string& file);
30 std::string
rel2abs(
const std::string& pwd,
const std::string& rel);
31 std::string
basename(
const std::string& file);
32 std::string
dirname(
const std::string& file);
35 std::string
findFirstUpwards(
const std::string& dir,
const std::string& file);
37 std::string
extension(
const std::string& name);
50 typedef std::vector<FilePerm>
Files;
57 void copyToRemote(
const std::string& rfile,
const std::string& local);
58 void copyFile(
const std::string& in,
const std::string& out);
65 bool fileStrFind(
const std::string& line,
const std::string& str);
83 static void forceUpdateAt(
const std::string& dir,
const std::string& res);
90 std::unordered_map<std::string, Strings> cache;
94 std::string noTrailingSlash(
const std::string& dir);
102 void add(
const std::string& file,
int line);
105 bool isDuplicate(
const std::string& a,
const std::string& b)
const override;
bool fileStrFind(const std::string &line, const std::string &str)
Definition: file_utils.cpp:292
#define MESSAGE(ed, fmt,...)
Definition: logger.h:50
std::unordered_map< std::string, std::string > OptionMap
Definition: editor.h:19
Strings split(const std::string &str, char delim)
Definition: utils.cpp:48
FileInfo readFileInfo(const std::string &arg)
Definition: file_utils.cpp:274
Files listDir(const std::string &dir)
Definition: file_utils.cpp:202
Definition: cmd_msg_bar.h:38
Definition: file_utils.h:40
Definition: editor_ops.cpp:214
int str2num(const std::string &str)
Definition: utils.cpp:73
std::string slurp(const std::string &file)
Definition: file_utils.cpp:81
bool isCurrentOrParentDir(const std::string &dir)
Definition: file_utils.cpp:302
bool strFind(const std::string &line, const std::string &str)
Definition: utils.cpp:237
Definition: file_utils.h:17
std::string copyFromRemote(const std::string &file)
Definition: file_utils.cpp:306
#define CMBAR_MSG(ed, fmt,...)
Definition: logger.h:52
char perms[10]
Definition: file_utils.h:44
void makeDir(const std::string &d)
Definition: file_utils.cpp:56
std::string extension(const std::string &name)
Definition: file_utils.cpp:172
std::string findFirstUpwards(const std::string &dir, const std::string &file)
Definition: file_utils.cpp:158
bool(* ChoicesFilter)(const std::string &, const std::string &)
Definition: cmd_msg_bar.h:10
CmdStatus check_output(const std::string &cmd)
Definition: utils.cpp:110
std::string name
Definition: file_utils.h:43
std::string urlHexify(const std::string &url)
Hexify the input url.
Definition: utils.cpp:169
bool isDir(const std::string &f)
Definition: file_utils.cpp:34
Strings listDirRel(const std::string &dir)
Definition: file_utils.cpp:221
std::string tempFileName()
Definition: file_utils.cpp:148
Definition: file_utils.h:72
std::string getFinalStr(int idx, const std::string &str) const
Definition: editor_ops.cpp:226
std::vector< std::string > Strings
Definition: utils.h:42
Remote(const std::string &f)
Definition: file_utils.cpp:70
Strings options
Definition: cmd_msg_bar.h:46
#define DEF_OP()
Definition: command.h:55
void copyFile(const std::string &in, const std::string &out)
Definition: file_utils.cpp:257
FilesHist(const std::string &file, int _max)
Definition: file_utils.h:101
void downloadUrl(const std::string &url, const std::string &file, const std::string &dnldProg, const std::string &dnldProgOpts)
Download the content of input url into the given file.
Definition: utils.cpp:179
std::pair< std::string, int > FileInfo
Definition: file_utils.h:60
DEF_CMD(Quit, "quit", "editor_ops", DEF_OP() { ed.requestQuitEventLoop();})
static DirCache & getInstance()
Definition: file_utils.cpp:323
bool isReadOnly(const char *f)
Definition: file_utils.cpp:52
void add(const std::string &file, int line)
Definition: file_utils.cpp:367
static Strings & getDirContents(const std::string &dir)
Definition: file_utils.cpp:348
std::string file
Definition: file_utils.h:18
std::string remoteFileType(const std::string &f)
Definition: file_utils.cpp:19
bool isDuplicate(const std::string &a, const std::string &b) const override
Definition: file_utils.cpp:372
bool isRemoteDir(const std::string &type)
Definition: file_utils.cpp:30
#define ASSERT(check, fmt,...)
Macro to assert with runtime_error exception if the check fails.
Definition: utils.h:35
void add(const std::string &elem)
Definition: utils.cpp:285
bool updateChoices(const std::string &str)
Definition: editor_ops.cpp:220
bool isAbs(const std::string &file)
Definition: file_utils.cpp:116
const Command & getCmd(const std::string &cmd)
Helper to return the command of interest.
Definition: command.cpp:23
std::string basename(const std::string &file)
Definition: file_utils.cpp:133
FileChoices(const Strings &arr, ChoicesFilter cf=fileStrFind)
Definition: editor_ops.cpp:216
FilePerm(const std::string &n)
Definition: file_utils.cpp:181
Container to store history (files-visited or command-history, etc)
Definition: utils.h:115
static const int DirModeFileOffset
Definition: file_utils.h:47
std::string getStr() const
Definition: option.cpp:26
const std::string & at(int idx) const
Definition: cmd_msg_bar.h:41
void copyToRemote(const std::string &rfile, const std::string &local)
Definition: file_utils.cpp:315
std::string rel2abs(const std::string &pwd, const std::string &rel)
Definition: file_utils.cpp:118
std::string gitBranchName(const std::string &dir)
Definition: utils.cpp:99
Definition: file_utils.h:99
std::string host
Definition: file_utils.h:18
static void forceUpdateAt(const std::string &dir, const Files &fs)
Definition: file_utils.cpp:328
static Option & get(const std::string &n)
Definition: option.cpp:40
Strings slurpToArr(const std::string &file)
Definition: file_utils.cpp:97
std::vector< FilePerm > Files
Definition: file_utils.h:50
std::string format(const char *fmt, va_list &vl)
Definition: utils.cpp:22
std::string dirname(const std::string &file)
Definition: file_utils.cpp:139
size_t size
Definition: file_utils.h:45
std::string getpwd()
Definition: file_utils.cpp:107
bool isFile(const std::string &f)
Definition: file_utils.cpp:43
#define CMBAR(ed, fmt,...)
Definition: logger.h:49
bool isRemote(const std::string &f)
Definition: file_utils.cpp:79
std::string listDir2str(const std::string &dir)
Definition: file_utils.cpp:241
bool FileCompare(const FilePerm &a, const FilePerm &b)
Definition: file_utils.cpp:197