DTR-CLI is a command-line interface tool designed to help manage and interact with code files in your directory. It includes various commands to initialize configurations, add code files, create new code files, read existing files, delete files, and manage boilerplate templates.
DTR-CLI already published on npm
npm install -g dtr-cli
-
Install package from npm:
sudo npm install -g dtr-cli
-
Find
dtr-cli
global location:which dtr # it will return like `/usr/local/bin/dtr` cd /usr/local/bin
-
Show
dtr-cli
all files:ls -la
It will return something like this:
lrwxrwxrwx 1 root root 42 Jul 17 23:09 dtr -> ../lib/node_modules/dtr-cli/build/index.js
Go to this
node_modules
folder:cd ../lib/node_modules/
-
Add read write permission:
sudo chmod 775 -R dtr-cli/
Now you are ready to use dtr-cli
by dtr
command
After installation, you can use the dtr
command followed by the specific subcommand.
dtr <command> [argument] [flags]
Initialize the dtr-config.json
configuration file.
dtr init
-c, --code <codeFolder>
: Path for the code file directory. This isoptional
. This isoptional
.
Add a code file to your directory.
dtr add
[codeName]
: Name of the code file you want to add. This isoptional
. This isoptional
.
Create a new code file.
dtr create
[codeName]
: Name of the code file. This isoptional
.
-f, --from <codeFrom>
: Source of the code file. Accepts'local'
|'internet'
. This isoptional
.-u, --url <internetURL>
: GitHub code URL if you select 'codeFrom' as 'internet'. This isoptional
.-p, --path <localPath>
: Current directory file path if you select 'codeFrom' as 'local'. This isoptional
.
Read all code files.
dtr read
[codeName]
: Name of the code file. This isoptional
.
Delete a global code file.
dtr delete
Create a new boilerplate template.
dtr create-template
[templateName]
: Name of the template. This isoptional
.
-s, --source <source>
: Source folder of the template. This isoptional
.
Add a boilerplate template in the current directory.
dtr template
[templateName]
: Name of the template. This isoptional
.
The dtr-config.json
file will be initialized by init
command. This file stores the configuration settings of current working directory.
Example dtr-config.json
:
{
"codeFolder": "code", // code folder name
"addedCode": [
{
"fileName": "",
"path": ""
}
// all code files
]
}
The configData.json
file will be initialized in the global root directory. This file stores the configuration settings for the CLI tool.
Example configData.json
:
{
"allFiles": [
{
"fileName": "",
"path": ""
}
// all code files
],
"allTemplates": [
{
"templateName": "",
"templateFolder": ""
}
// all templates
]
}
-
Clone the repository:
git clone https://github.com/saiful7778/dtr-cli.git cd dtr-cli
-
Install dependencies:
npm install # or yarn install # or pnpm install # or bun install
Note: Here I use
bun
you can any of them
-
Build the package:
npm run build # or yarn run build # or pnpm run build # or bun run build