@aryanbhosale/pick 0.1.2 → 0.1.7
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.
- package/README.md +31 -2
- package/package.json +14 -7
package/README.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# pick
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@aryanbhosale/pick)
|
|
4
|
+
[](https://www.npmjs.com/package/@aryanbhosale/pick)
|
|
5
|
+
[](https://github.com/aryanbhosale/pick/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/aryanbhosale/pick/blob/main/LICENSE)
|
|
7
|
+
|
|
3
8
|
Extract values from anything — JSON, YAML, TOML, .env, HTTP headers, logfmt, CSV, and more.
|
|
4
9
|
|
|
5
10
|
```bash
|
|
6
11
|
npm install -g @aryanbhosale/pick
|
|
7
12
|
```
|
|
8
13
|
|
|
14
|
+
`pick` auto-detects the input format and lets you extract values using a simple selector syntax. No more juggling `jq`, `yq`, `grep`, `awk`, and `cut` for different formats.
|
|
15
|
+
|
|
9
16
|
## Usage
|
|
10
17
|
|
|
11
18
|
```bash
|
|
@@ -54,12 +61,14 @@ cat data.csv | pick '[0].name'
|
|
|
54
61
|
|
|
55
62
|
| Flag | Description |
|
|
56
63
|
|---|---|
|
|
57
|
-
| `-i, --input <format>` | Force input format |
|
|
64
|
+
| `-i, --input <format>` | Force input format (`json`, `yaml`, `toml`, `env`, `headers`, `logfmt`, `csv`, `text`) |
|
|
58
65
|
| `-f, --file <path>` | Read from file instead of stdin |
|
|
59
|
-
| `--json` | Output as JSON |
|
|
66
|
+
| `--json` | Output result as JSON |
|
|
67
|
+
| `--raw` | Output without trailing newline |
|
|
60
68
|
| `-1, --first` | Only first result |
|
|
61
69
|
| `--lines` | One element per line |
|
|
62
70
|
| `-d, --default <value>` | Fallback value |
|
|
71
|
+
| `-q, --quiet` | Suppress error messages |
|
|
63
72
|
| `-e, --exists` | Check if selector matches (exit code only) |
|
|
64
73
|
| `-c, --count` | Count matches |
|
|
65
74
|
|
|
@@ -67,11 +76,31 @@ cat data.csv | pick '[0].name'
|
|
|
67
76
|
|
|
68
77
|
JSON, YAML, TOML, .env, HTTP headers, logfmt, CSV/TSV, and plain text. Format is auto-detected — use `-i` to override.
|
|
69
78
|
|
|
79
|
+
## Pipe-friendly
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Get all repo names
|
|
83
|
+
curl -s https://api.github.com/users/octocat/repos | pick '[*].name' --lines
|
|
84
|
+
|
|
85
|
+
# Check if key exists
|
|
86
|
+
if cat config.json | pick database.host --exists; then
|
|
87
|
+
DB_HOST=$(cat config.json | pick database.host)
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Extract with fallback
|
|
91
|
+
cat config.yaml | pick server.port --default 3000
|
|
92
|
+
|
|
93
|
+
# Count results
|
|
94
|
+
echo '[1,2,3,4,5]' | pick '[*]' --count
|
|
95
|
+
# 5
|
|
96
|
+
```
|
|
97
|
+
|
|
70
98
|
## Links
|
|
71
99
|
|
|
72
100
|
- [Documentation & examples](https://pick-cli.pages.dev)
|
|
73
101
|
- [GitHub](https://github.com/aryanbhosale/pick)
|
|
74
102
|
- [Issues](https://github.com/aryanbhosale/pick/issues)
|
|
103
|
+
- [Changelog](https://github.com/aryanbhosale/pick/blob/main/CHANGELOG.md)
|
|
75
104
|
|
|
76
105
|
## License
|
|
77
106
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryanbhosale/pick",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Extract values from anything — JSON, YAML, TOML, .env, HTTP headers, logfmt, CSV, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://pick-cli.pages.dev",
|
|
@@ -15,11 +15,18 @@
|
|
|
15
15
|
"yaml",
|
|
16
16
|
"toml",
|
|
17
17
|
"env",
|
|
18
|
+
"dotenv",
|
|
18
19
|
"logfmt",
|
|
19
20
|
"csv",
|
|
20
21
|
"jq",
|
|
21
22
|
"yq",
|
|
22
|
-
"parser"
|
|
23
|
+
"parser",
|
|
24
|
+
"pipe",
|
|
25
|
+
"data-extraction",
|
|
26
|
+
"http-headers",
|
|
27
|
+
"key-value",
|
|
28
|
+
"command-line",
|
|
29
|
+
"developer-tools"
|
|
23
30
|
],
|
|
24
31
|
"bin": {
|
|
25
32
|
"pick": "bin/pick.js"
|
|
@@ -28,10 +35,10 @@
|
|
|
28
35
|
"bin"
|
|
29
36
|
],
|
|
30
37
|
"optionalDependencies": {
|
|
31
|
-
"@aryanbhosale/pick-darwin-arm64": "0.1.
|
|
32
|
-
"@aryanbhosale/pick-darwin-x64": "0.1.
|
|
33
|
-
"@aryanbhosale/pick-linux-x64": "0.1.
|
|
34
|
-
"@aryanbhosale/pick-linux-arm64": "0.1.
|
|
35
|
-
"@aryanbhosale/pick-win32-x64": "0.1.
|
|
38
|
+
"@aryanbhosale/pick-darwin-arm64": "0.1.7",
|
|
39
|
+
"@aryanbhosale/pick-darwin-x64": "0.1.7",
|
|
40
|
+
"@aryanbhosale/pick-linux-x64": "0.1.7",
|
|
41
|
+
"@aryanbhosale/pick-linux-arm64": "0.1.7",
|
|
42
|
+
"@aryanbhosale/pick-win32-x64": "0.1.7"
|
|
36
43
|
}
|
|
37
44
|
}
|