Skip to content

Commit c7d0c55

Browse files
authored
Merge pull request #2 from ioncakephper:chore/create-cli-app
Chore/create-cli-app
2 parents c70b032 + dc0d5c0 commit c7d0c55

File tree

8 files changed

+57
-21
lines changed

8 files changed

+57
-21
lines changed

.vscode/launch.json

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,18 @@
44
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
55
"version": "0.2.0",
66
"configurations": [
7-
87
{
9-
"type": "node",
10-
"name": "vscode-jest-tests.v2.insert-file-tag",
11-
"request": "launch",
8+
"name": "Launch Program",
9+
"program": "${workspaceFolder}\\bin\\cli.js",
1210
"args": [
13-
"--runInBand",
14-
"--watchAll=false",
15-
"--testNamePattern",
16-
"${jest.testNamePattern}",
17-
"--runTestsByPath",
18-
"${jest.testFile}"
11+
"SAMPLE_README.md"
12+
],
13+
"request": "launch",
14+
"skipFiles": [
15+
"<node_internals>/**"
1916
],
20-
"cwd": "${workspaceFolder}",
21-
"console": "integratedTerminal",
22-
"internalConsoleOptions": "neverOpen",
23-
"disableOptimisticBPs": true,
24-
"program": "${workspaceFolder}/node_modules/.bin/jest",
25-
"windows": {
26-
"program": "${workspaceFolder}/node_modules/jest/bin/jest"
27-
}
17+
"type": "node"
2818
}
19+
2920
]
3021
}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
# Changelog
22

33
*Changelog created using the [Simple Changelog](https://marketplace.visualstudio.com/items?itemName=tobiaswaelde.vscode-simple-changelog) extension for VS Code.*
4+
5+
## [1.0.0] - 2024-12-16
6+
### Added
7+
- Add instags in bin property
8+
- Added cli.js in bin folder

bin/cli.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env node
2+
3+
const { Command } = require('commander');
4+
const { processAndSaveFileWithTags } = require('../src/source-processor');
5+
const packageJson = require('../package.json');
6+
const path = require('path');
7+
8+
const program = new Command();
9+
10+
program
11+
.name(packageJson.name)
12+
.version(packageJson.version)
13+
.description(packageJson.description)
14+
.argument('<filename>', 'file to process for insert tags')
15+
.option('-o, --output <output>', 'output filename', '')
16+
.action((filename, options) => {
17+
const outputFilename = options.output || filename;
18+
processAndSaveFileWithTags(filename, outputFilename);
19+
});
20+
21+
program.parse(process.argv);
22+
23+
if (!program.args.length) {
24+
program.help();
25+
}
26+

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"automation"
1111
],
1212
"main": "index.js",
13+
"bin": {
14+
"instags": "../bin/cli.js"
15+
},
1316
"repository": {
1417
"type": "git",
1518
"url": "git+https://github.com/ioncakephper/insert-file-tag.git"
@@ -27,6 +30,7 @@
2730
"test": "jest"
2831
},
2932
"dependencies": {
33+
"commander": "^12.1.0",
3034
"fs": "^0.0.1-security",
3135
"fs-extra": "^11.1.1"
3236
},

source.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

target.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

test.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)