aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-03-04 20:54:50 +0100
committerpennae <github@quasiparticle.net>2022-04-21 21:25:18 +0200
commit39df15fb8e766c0a4fa2fda83784fb8a478a766c (patch)
tree8f60f47059cf33b6b9c62b92bbbd6783868b1d47 /src/libcmd
parent38de79fcf7e00187107e638036c010911d1b675b (diff)
don't use full Pos for findPackageFilename/editorFor
only file and line of the returned position were ever used, it wasn't actually used a position. as such we may as well use a path+int pair for only those two values and remove a use of Pos that would not work well with a position table.
Diffstat (limited to 'src/libcmd')
-rw-r--r--src/libcmd/command.cc8
-rw-r--r--src/libcmd/command.hh2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc
index a53b029b7..f28cfe5de 100644
--- a/src/libcmd/command.cc
+++ b/src/libcmd/command.cc
@@ -197,17 +197,17 @@ void StorePathCommand::run(ref<Store> store, std::vector<StorePath> && storePath
run(store, *storePaths.begin());
}
-Strings editorFor(const Pos & pos)
+Strings editorFor(const Path & file, uint32_t line)
{
auto editor = getEnv("EDITOR").value_or("cat");
auto args = tokenizeString<Strings>(editor);
- if (pos.line > 0 && (
+ if (line > 0 && (
editor.find("emacs") != std::string::npos ||
editor.find("nano") != std::string::npos ||
editor.find("vim") != std::string::npos ||
editor.find("kak") != std::string::npos))
- args.push_back(fmt("+%d", pos.line));
- args.push_back(pos.file);
+ args.push_back(fmt("+%d", line));
+ args.push_back(file);
return args;
}
diff --git a/src/libcmd/command.hh b/src/libcmd/command.hh
index 84bbb5292..078e2a2ce 100644
--- a/src/libcmd/command.hh
+++ b/src/libcmd/command.hh
@@ -219,7 +219,7 @@ static RegisterCommand registerCommand2(std::vector<std::string> && name)
/* Helper function to generate args that invoke $EDITOR on
filename:lineno. */
-Strings editorFor(const Pos & pos);
+Strings editorFor(const Path & file, uint32_t line);
struct MixProfile : virtual StoreCommand
{