mirror of
https://github.com/vale981/tridactyl
synced 2025-03-05 17:41:40 -05:00
Document alias processing functions
This commit is contained in:
parent
aff1ada83f
commit
4cf8c25cb8
1 changed files with 12 additions and 0 deletions
|
@ -4,6 +4,12 @@ export function commandIsAlias(command: string): boolean {
|
||||||
return Config.get("exaliases", command) !== undefined
|
return Config.get("exaliases", command) !== undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expands the alias in the provided exstr recursively. Does nothing if
|
||||||
|
* the command is not aliased, including when the command is invalid.
|
||||||
|
*
|
||||||
|
* @param exstr :exstr typed by the user on the commantd line
|
||||||
|
*/
|
||||||
export function expandExstr(exstr: string): string {
|
export function expandExstr(exstr: string): string {
|
||||||
// Split on whitespace
|
// Split on whitespace
|
||||||
const [command, ...args] = exstr.trim().split(/\s+/)
|
const [command, ...args] = exstr.trim().split(/\s+/)
|
||||||
|
@ -14,6 +20,12 @@ export function expandExstr(exstr: string): string {
|
||||||
return expandedExstr
|
return expandedExstr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Expands the given command recursively. Does nothing if the command is not
|
||||||
|
* aliased, including when it is invalid.
|
||||||
|
*
|
||||||
|
* @param command The command portion of the exstr
|
||||||
|
*/
|
||||||
export function getAliasExpandRecur(command: string): string {
|
export function getAliasExpandRecur(command: string): string {
|
||||||
// Base case: alias not found; return original command
|
// Base case: alias not found; return original command
|
||||||
if(!commandIsAlias(command)) {
|
if(!commandIsAlias(command)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue