updated grep for ls

* implemented flags logic for grep
* added --grep and -g
* updated docs
This commit is contained in:
phyzical
2022-02-05 23:27:08 +08:00
parent 9ddb1c4379
commit 9a3731cf18
3 changed files with 39 additions and 35 deletions
+6 -6
View File
@@ -26,7 +26,7 @@ export const TerminalHelpText: string[] = [
" hostname Displays the hostname of the machine",
" kill [script/pid] [args...] Stops the specified script on the current server ",
" killall Stops all running scripts on the current machine",
" ls [dir] [| grep pattern] Displays all files on the machine",
" ls [dir] [--grep pattern] Displays all files on the machine",
" lscpu Displays the number of CPU cores on the machine",
" mem [script] [-t n] Displays the amount of RAM required to run the script",
" mv [src] [dest] Move/rename a text or script file",
@@ -295,28 +295,28 @@ export const HelpTexts: IMap<string[]> = {
" ",
],
ls: [
"Usage: ls [dir] [| grep pattern]",
"Usage: ls [dir] [--grep pattern]",
" ",
"The ls command, with no arguments, prints all files and directories on the current server's directory to the Terminal screen. ",
"The files will be displayed in alphabetical order. ",
" ",
"The 'dir' optional parameter can be used to display files/directories in another directory.",
" ",
"The '| grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern.",
"The '--grep pattern' optional parameter can be used to only display files whose filenames match the specified pattern.",
" ",
"Examples:",
" ",
"List all files with the '.script' extension in the current directory:",
" ",
" ls | grep .script",
" ls --grep .script",
" ",
"List all files with the '.js' extension in the root directory:",
" ",
" ls / | grep .js",
" ls / --grep .js",
" ",
"List all files with the word 'purchase' in the filename, in the 'scripts' directory:",
" ",
" ls scripts | grep purchase",
" ls scripts --grep purchase",
" ",
],
lscpu: ["Usage: lscpu", " ", "Prints the number of CPU Cores the current server has", " "],