-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b22862
commit 329829a
Showing
13 changed files
with
3,035 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional REPL history | ||
.node_repl_history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"cSpell.words": [ | ||
"Codeburst", | ||
"scandir", | ||
"snipercode", | ||
"Twilio" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,74 @@ | ||
# SniperCode.FileSystem.Cli | ||
A command line interface for file handling using SniperCode.FileSystem | ||
|
||
 | ||
 | ||
 | ||
|
||
## **Table of Contents** | ||
|
||
- [SniperCode.FileSystem.Cli](#snipercodefilesystemcli) | ||
- [**Table of Contents**](#table-of-contents) | ||
- [**Introduction**](#introduction) | ||
- [**Installation**](#installation) | ||
- [**Uninstall**](#uninstall) | ||
- [**Usage**](#usage) | ||
- [**References**](#references) | ||
- [**Articles**](#articles) | ||
- [**Packages**](#packages) | ||
- [**ToDo**](#todo) | ||
- [**Release**](#release) | ||
|
||
## **Introduction** | ||
|
||
A command line interface for file handling using [SniperCode.FileSystem](https://github.com/Sniper-Code/SniperCode.FileSystem) | ||
|
||
## **Installation** | ||
|
||
To install the package, run the following command: | ||
|
||
```bash | ||
npm install sniperCode.filesystem.cli | ||
``` | ||
|
||
## **Uninstall** | ||
|
||
To uninstall SniperCode.FileSystem, run `npm uninstall sniperCode.filesystem.cli`. | ||
|
||
## **Usage** | ||
|
||
This package is a command line interface for file handling using [SniperCode.FileSystem](https://github.com/Sniper-Code/SniperCode.FileSystem) package. It provides a command line interface for file handling along with some other useful commands. After the installation, you can run the following command to see the usage of SniperCode.FileSystem.Cli: | ||
|
||
```bash | ||
sfs | ||
``` | ||
|
||
This command will show the usage of SniperCode.FileSystem.Cli as shown in picture below. | ||
|
||
 | ||
|
||
## **References** | ||
|
||
All references required while building this package are listed in this document. | ||
|
||
### **Articles** | ||
|
||
1. [Codeburst.io](https://codeburst.io/build-a-command-line-interface-cli-application-with-node-js-59becec90e28) | ||
2. [Twilio.com](https://www.twilio.com/blog/how-to-build-a-cli-with-node-js) | ||
|
||
### **Packages** | ||
|
||
1. [SniperCode.FileSystem](https://github.com/Sniper-Code/SniperCode.FileSystem) | ||
2. [Commander](https://www.npmjs.com/package/commander) | ||
3. [Inquirer](https://www.npmjs.com/package/inquirer) | ||
4. [Color](https://www.npmjs.com/package/colors) | ||
5. [Config](https://www.npmjs.com/package/config) | ||
|
||
## **ToDo** | ||
|
||
1. [ ] Direct execution instead of using [Inquirer](https://www.npmjs.com/package/inquirer) . | ||
2. [ ] Backward compatibility with older terminal. | ||
3. [ ] Custom terminal. | ||
|
||
## **Release** | ||
|
||
Visit[GitHub Release](https://github.com/Sniper-Code/SniperCode.FileSystem.Cli/releases) to see the latest release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
|
||
/** | ||
* @function get_all_Commands | ||
* @description This function returns all the commands available in the package. | ||
* @param {Commands} cmd | ||
* @return {Array[Object]} | ||
*/ | ||
export function get_all_Commands(cmd) { | ||
return [ | ||
// File Append | ||
{ | ||
command: 'apfile', | ||
description: 'append to a file', | ||
action: cmd.Commands.File.Append, | ||
}, | ||
// Clear | ||
{ | ||
command: 'clear', | ||
description: 'clear the screen', | ||
action: cmd.Commands.Clear | ||
}, | ||
// Copy Directory | ||
{ | ||
command: 'cpdir', | ||
description: 'copy a directory to another directory', | ||
action: cmd.Commands.Directory.Copy, | ||
}, | ||
// File Copy | ||
{ | ||
command: 'cpfile', | ||
description: 'copy a file to another file', | ||
action: cmd.Commands.File.Copy, | ||
}, | ||
// Exists Directory | ||
{ | ||
command: 'exdir', | ||
description: 'Check if a directory exists', | ||
action: cmd.Commands.Directory.Exists, | ||
}, | ||
// Exists File | ||
{ | ||
command: 'exfile', | ||
description: 'Check if a file exists', | ||
action: cmd.Commands.File.Exists, | ||
}, | ||
// Execute Command | ||
{ | ||
command: 'exec', | ||
description: 'execute a command', | ||
action: cmd.Commands.Shell, | ||
}, | ||
// Ip Address | ||
{ | ||
command: 'ip', | ||
description: 'get the ip address', | ||
action: cmd.Commands.Network.IpAddress | ||
}, | ||
// Is Directory | ||
{ | ||
command: 'isdir', | ||
description: 'check if a path is a directory', | ||
action: cmd.Commands.Directory.Is, | ||
}, | ||
// Is File | ||
{ | ||
command: 'isfile', | ||
description: 'check if a path is a file', | ||
action: cmd.Commands.File.Is, | ||
}, | ||
// Operating System | ||
{ | ||
command: 'os', | ||
description: 'get the operating system', | ||
action: cmd.Commands.Operating_System.Name | ||
}, | ||
// Directory Create | ||
{ | ||
command: 'mkdir', | ||
description: 'create a directory', | ||
action: cmd.Commands.Directory.Create | ||
}, | ||
// File Create | ||
{ | ||
command: 'mkfile', | ||
description: 'create a file', | ||
action: cmd.Commands.File.Create, | ||
}, | ||
// Move directory | ||
{ | ||
command: 'mvdir', | ||
description: 'move a directory', | ||
action: cmd.Commands.Directory.Move | ||
}, | ||
// File Move | ||
{ | ||
command: 'mvfile', | ||
description: 'move a file', | ||
action: cmd.Commands.File.Move, | ||
}, | ||
// Name of the directory | ||
{ | ||
command: 'nmdir', | ||
description: 'get the name of the directory', | ||
action: cmd.Commands.Directory.Name | ||
}, | ||
// Name of the file | ||
{ | ||
command: 'nmfile', | ||
description: 'get the name of the file', | ||
action: cmd.Commands.File.Name | ||
}, | ||
// Name of file with extension | ||
{ | ||
command: 'nmextfile', | ||
description: 'get the name of the file with extension', | ||
action: cmd.Commands.File.With_Extension | ||
}, | ||
// Path Directory | ||
{ | ||
command: 'pwdir', | ||
description: 'get the path of given directory', | ||
action: cmd.Commands.Directory.Path | ||
}, | ||
// Path File | ||
{ | ||
command: 'pwfile', | ||
description: 'get the path of given file', | ||
action: cmd.Commands.File.Path | ||
}, | ||
// Read File | ||
{ | ||
command: 'readfile', | ||
description: 'read a file', | ||
action: cmd.Commands.File.Read, | ||
}, | ||
// Rename Directory | ||
{ | ||
command: 'rendir', | ||
description: 'rename a directory', | ||
action: cmd.Commands.Directory.Rename | ||
}, | ||
// File Rename | ||
{ | ||
command: 'renfile', | ||
description: 'rename a file', | ||
action: cmd.Commands.File.Rename, | ||
}, | ||
// Directory Delete | ||
{ | ||
command: 'rmdir', | ||
description: 'delete a directory', | ||
action: cmd.Commands.Directory.Delete | ||
}, | ||
// File Remove | ||
{ | ||
command: 'rmfile', | ||
description: 'delete a file', | ||
action: cmd.Commands.File.Delete, | ||
}, | ||
// Directory List -> Default | ||
{ | ||
command: 'scandir', | ||
description: 'list all the directories in specified path at depth 1', | ||
action: cmd.Commands.Directory.List.Default | ||
}, | ||
// Directory List -> Depth | ||
{ | ||
command: 'scandird', | ||
description: 'list all the directories till the specified depth', | ||
action: cmd.Commands.Directory.List.Depth | ||
}, | ||
// Directory List -> Recursive | ||
{ | ||
command: 'scandirr', | ||
description: 'list all the directories recursively', | ||
action: cmd.Commands.Directory.List.Recursive | ||
}, | ||
// Search | ||
{ | ||
command: 'search', | ||
description: 'search for a file or directory', | ||
action: cmd.Commands.Search | ||
}, | ||
// File Size | ||
{ | ||
command: 'sizefile', | ||
description: 'get the size of a file', | ||
action: cmd.Commands.File.Size | ||
}, | ||
// File Status | ||
{ | ||
command: 'statfile', | ||
description: 'get the status of a file', | ||
action: cmd.Commands.File.Stats | ||
}, | ||
// File Update | ||
{ | ||
command: 'upfile', | ||
description: 'update a file', | ||
action: cmd.Commands.File.Update, | ||
}, | ||
] | ||
} |
Oops, something went wrong.