mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 14:32:27 +01:00
add rough implementation of 'cdpath' option
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,6 +1,7 @@
|
|||||||
<pre>
|
<pre>
|
||||||
2008-08-16:
|
2008-08-16:
|
||||||
* version 2.0 (probably)
|
* version 2.0 (probably)
|
||||||
|
* add 'cdpath' option
|
||||||
* allow :dialog to open the cookies manager
|
* allow :dialog to open the cookies manager
|
||||||
* add 'loadplugins' option
|
* add 'loadplugins' option
|
||||||
* add count support to C-^ (Kazuo)
|
* add count support to C-^ (Kazuo)
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ liberator.IO = function () //{{{
|
|||||||
////////////////////// OPTIONS ////////////////////////////////////////////////
|
////////////////////// OPTIONS ////////////////////////////////////////////////
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
/////////////////////////////////////////////////////////////////////////////{{{
|
||||||
|
|
||||||
|
var cdpath = "," + (environmentService.get("CDPATH").replace(/[:;]/g, ",") || ",");
|
||||||
|
|
||||||
|
// TODO: setter should expand environment variables
|
||||||
|
liberator.options.add(["cdpath", "cd"],
|
||||||
|
"List of directories searched when executing :cd",
|
||||||
|
"stringlist", cdpath);
|
||||||
|
|
||||||
var shell, shellcmdflag;
|
var shell, shellcmdflag;
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
@@ -94,8 +101,45 @@ liberator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (liberator.io.setCurrentDirectory(args))
|
// go directly to an absolute path or look for a relative path
|
||||||
liberator.echo(liberator.io.getCurrentDirectory());
|
// match in 'cdpath'
|
||||||
|
if (/^(~|\/|\.\/|\.\.\/)/.test(args))
|
||||||
|
{
|
||||||
|
// TODO: apparently we don't handle ../ or ./ paths yet
|
||||||
|
if (liberator.io.setCurrentDirectory(args))
|
||||||
|
liberator.echo(liberator.io.getCurrentDirectory());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var directories = liberator.options["cdpath"].replace(/^,$|^,,|,,$/, "").split(",");
|
||||||
|
|
||||||
|
// empty 'cdpath' items mean the current directory
|
||||||
|
directories = directories.map(function (directory) {
|
||||||
|
return directory == "" ? liberator.io.getCurrentDirectory() : directory;
|
||||||
|
});
|
||||||
|
|
||||||
|
var directoryFound = false;
|
||||||
|
|
||||||
|
for (let i = 0; i < directories.length; i++)
|
||||||
|
{
|
||||||
|
var dir = directories[i] + liberator.io.directorySeperator + args;
|
||||||
|
if (liberator.io.setCurrentDirectory(dir))
|
||||||
|
{
|
||||||
|
// FIXME: we're just overwriting the error message from
|
||||||
|
// setCurrentDirectory here
|
||||||
|
liberator.echo(liberator.io.getCurrentDirectory());
|
||||||
|
directoryFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!directoryFound)
|
||||||
|
{
|
||||||
|
liberator.echoerr("E344: Can't find directory \"" + args + "\" in cdpath"
|
||||||
|
+ "\n"
|
||||||
|
+ "E472: Command failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.file(filter, true); }
|
completer: function (filter) { return liberator.completion.file(filter, true); }
|
||||||
@@ -324,6 +368,7 @@ liberator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
[cwd, oldcwd] = [newdir, this.getCurrentDirectory()];
|
[cwd, oldcwd] = [newdir, this.getCurrentDirectory()];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ioManager.getCurrentDirectory();
|
return ioManager.getCurrentDirectory();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -203,6 +203,15 @@ Foreground color of the current active link during hint mode.
|
|||||||
____
|
____
|
||||||
|
|
||||||
|
|
||||||
|
|\'cd'| |\'cdpath'|
|
||||||
|
||'cdpath' 'cd'|| string (default: black)
|
||||||
|
____
|
||||||
|
List of directories searched when executing the :cd command. This is only used
|
||||||
|
for relative paths, if an absolute path is specified then the option is
|
||||||
|
ignored.
|
||||||
|
____
|
||||||
|
|
||||||
|
|
||||||
|\'cpt'| |\'complete'|
|
|\'cpt'| |\'complete'|
|
||||||
||'complete' 'cpt'|| charlist (default: sfbh)
|
||'complete' 'cpt'|| charlist (default: sfbh)
|
||||||
____
|
____
|
||||||
@@ -444,8 +453,8 @@ This includes (X)HTML elements with an "href" atrribute and XLink "simple" links
|
|||||||
____
|
____
|
||||||
|
|
||||||
|
|
||||||
|\'noloadplugins'| |\'loadplugins'|
|
|\'nolpl'| |\'lpl'||\'noloadplugins'| |\'loadplugins'|
|
||||||
||'loadplugins'|| boolean (default on)
|
||'loadplugins' 'lpl'|| boolean (default on)
|
||||||
____
|
____
|
||||||
Load plugin scripts when starting up.
|
Load plugin scripts when starting up.
|
||||||
____
|
____
|
||||||
|
|||||||
Reference in New Issue
Block a user