mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 20:55:44 +01:00
TERMINAL: Updated Alias/Unalias (#914)
This commit is contained in:
parent
89fc22f28f
commit
21c7f56d23
@ -99,6 +99,7 @@ export const HelpTexts: Record<string, string[]> = {
|
|||||||
"'alias NAME=VALUE' on the Terminal. ",
|
"'alias NAME=VALUE' on the Terminal. ",
|
||||||
" ",
|
" ",
|
||||||
"The 'unalias' command can be used to remove aliases.",
|
"The 'unalias' command can be used to remove aliases.",
|
||||||
|
"NOTE: The --all alias is reserved for removal.",
|
||||||
" ",
|
" ",
|
||||||
],
|
],
|
||||||
analyze: [
|
analyze: [
|
||||||
@ -443,8 +444,10 @@ export const HelpTexts: Record<string, string[]> = {
|
|||||||
],
|
],
|
||||||
unalias: [
|
unalias: [
|
||||||
"Usage: unalias [alias name]",
|
"Usage: unalias [alias name]",
|
||||||
|
"Usage: unalias -all",
|
||||||
" ",
|
" ",
|
||||||
"Deletes the specified alias. Note that the double quotation marks are required. ",
|
"Deletes the specified alias. Note that the double quotation marks are required. ",
|
||||||
|
"The --all command will remove ALL aliases that you have set.",
|
||||||
" ",
|
" ",
|
||||||
"As an example, if an alias was declared using:",
|
"As an example, if an alias was declared using:",
|
||||||
" ",
|
" ",
|
||||||
|
@ -6,6 +6,10 @@ export function alias(args: (string | number | boolean)[]): void {
|
|||||||
printAliases();
|
printAliases();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (args[0] === "--all") {
|
||||||
|
Terminal.error(`--all is reserved for removal`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (args.length === 1) {
|
if (args.length === 1) {
|
||||||
if (parseAliasDeclaration(args[0] + "")) {
|
if (parseAliasDeclaration(args[0] + "")) {
|
||||||
Terminal.print(`Set alias ${args[0]}`);
|
Terminal.print(`Set alias ${args[0]}`);
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
import { Terminal } from "../../Terminal";
|
import { Terminal } from "../../Terminal";
|
||||||
import { removeAlias } from "../../Alias";
|
import { removeAlias, Aliases, GlobalAliases } from "../../Alias";
|
||||||
|
|
||||||
export function unalias(args: (string | number | boolean)[]): void {
|
export function unalias(args: (string | number | boolean)[]): void {
|
||||||
if (args.length !== 1) {
|
if (args.length !== 1) {
|
||||||
Terminal.error("Incorrect usage of unalias name. Usage: unalias [alias]");
|
Terminal.error("Incorrect usage of unalias name. Usage: unalias [alias] or unalias --all");
|
||||||
return;
|
return;
|
||||||
|
} else if (args[0] === "--all") {
|
||||||
|
for (const alias of Aliases) {
|
||||||
|
if (removeAlias(alias[0] + "")) {
|
||||||
|
Terminal.print(`Removed alias ${alias[0]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (const alias of GlobalAliases) {
|
||||||
|
if (removeAlias(alias[0] + "")) {
|
||||||
|
Terminal.print(`Removed alias ${alias[0]}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (removeAlias(args[0] + "")) {
|
} else if (removeAlias(args[0] + "")) {
|
||||||
Terminal.print(`Removed alias ${args[0]}`);
|
Terminal.print(`Removed alias ${args[0]}`);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user