sondakika 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const Parser = require('rss-parser');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const packagePath = path.join(__dirname, 'package.json');
8
+ const { version } = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
4
9
 
5
10
  const sources = {
6
11
  ntv: 'https://www.ntv.com.tr/son-dakika.rss',
@@ -143,12 +148,14 @@ async function fetchNews(source, count) {
143
148
 
144
149
  const args = process.argv.slice(2);
145
150
 
146
- if (args.length === 0 || args[0] === '--help') {
151
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
147
152
  console.log(`
148
- 📰 Sondakika - Son dakika haberleri CLI
153
+ 📰 Sondakika v${version} - Son dakika haberleri CLI
149
154
 
150
155
  Usage:
151
156
  sondakika <source> [count]
157
+ sondakika --version
158
+ sondakika --help
152
159
 
153
160
  Sources (Son Dakika):
154
161
  ntv NTV Son Dakika
@@ -176,6 +183,11 @@ Examples:
176
183
  process.exit(0);
177
184
  }
178
185
 
186
+ if (args[0] === '--version' || args[0] === '-v') {
187
+ console.log(`sondakika v${version}`);
188
+ process.exit(0);
189
+ }
190
+
179
191
  const source = args[0];
180
192
  const count = args[1] ? parseInt(args[1]) : 10;
181
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sondakika",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Farkli kanallarin son dakika haberlerine komut satiri uzerinden kolayca ulasin.",
5
5
  "main": "index.js",
6
6
  "bin": {