amaprice 1.0.4 → 1.0.5

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 (3) hide show
  1. package/README.md +3 -0
  2. package/bin/cli.js +10 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,8 @@ npm install -g amaprice
12
12
 
13
13
  ```bash
14
14
  # One-shot price lookup
15
+ amaprice "https://www.amazon.de/dp/B0DZ5P7JD6"
16
+ amaprice B0DZ5P7JD6
15
17
  amaprice price "https://www.amazon.de/dp/B0DZ5P7JD6"
16
18
  amaprice price B0DZ5P7JD6
17
19
  amaprice price
@@ -37,6 +39,7 @@ amaprice list
37
39
 
38
40
  | Command | Description |
39
41
  |---|---|
42
+ | `amaprice [url\|asin]` | Shortcut for `amaprice price [url\|asin]` |
40
43
  | `amaprice price [url\|asin]` | One-shot price lookup (or prompt if omitted) |
41
44
  | `amaprice track [url\|asin]` | Track a product's price (or prompt if omitted) |
42
45
  | `amaprice history <url\|asin>` | Show price history (`--limit N`, default 30) |
package/bin/cli.js CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  const { program } = require('commander');
4
4
  const pkg = require('../package.json');
5
+ const KNOWN_COMMANDS = new Set(['price', 'track', 'history', 'list', 'help']);
6
+
7
+ const userArgs = process.argv.slice(2);
8
+ if (userArgs.length > 0) {
9
+ const firstArg = userArgs[0];
10
+ // Convenience mode: treat `amaprice <url-or-asin>` as `amaprice price <url-or-asin>`.
11
+ if (!firstArg.startsWith('-') && !KNOWN_COMMANDS.has(firstArg)) {
12
+ process.argv.splice(2, 0, 'price');
13
+ }
14
+ }
5
15
 
6
16
  program
7
17
  .name('amaprice')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amaprice",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "CLI tool to scrape and track Amazon product prices",
5
5
  "main": "src/scraper.js",
6
6
  "type": "commonjs",