parent
365887539b
commit
6181781f3d
|
@ -1857,7 +1857,7 @@ const CommandDesc change_working_directory_cmd = {
|
||||||
"cd",
|
"cd",
|
||||||
nullptr,
|
nullptr,
|
||||||
"cd <dir>: change server working directory to <dir>",
|
"cd <dir>: change server working directory to <dir>",
|
||||||
single_name_param,
|
single_optional_name_param,
|
||||||
CommandFlags::None,
|
CommandFlags::None,
|
||||||
CommandHelper{},
|
CommandHelper{},
|
||||||
PerArgumentCommandCompleter{{
|
PerArgumentCommandCompleter{{
|
||||||
|
@ -1871,8 +1871,10 @@ const CommandDesc change_working_directory_cmd = {
|
||||||
}},
|
}},
|
||||||
[](const ParametersParser& parser, Context&, const ShellContext&)
|
[](const ParametersParser& parser, Context&, const ShellContext&)
|
||||||
{
|
{
|
||||||
if (chdir(parse_filename(parser[0]).c_str()) != 0)
|
|
||||||
throw runtime_error(format("cannot change to directory '{}'", parser[0]));
|
StringView target = parser.positional_count() == 1 ? parser[0] : "~";
|
||||||
|
if (chdir(parse_filename(target).c_str()) != 0)
|
||||||
|
throw runtime_error(format("cannot change to directory '{}'", target));
|
||||||
for (auto& buffer : BufferManager::instance())
|
for (auto& buffer : BufferManager::instance())
|
||||||
buffer->update_display_name();
|
buffer->update_display_name();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user