@aryanbhosale/pick 0.1.0 → 0.1.1
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 +78 -0
- package/package.json +6 -6
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# pick
|
|
2
|
+
|
|
3
|
+
Extract values from anything — JSON, YAML, TOML, .env, HTTP headers, logfmt, CSV, and more.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install -g @aryanbhosale/pick
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# JSON
|
|
13
|
+
curl -s https://api.github.com/users/octocat | pick login
|
|
14
|
+
# octocat
|
|
15
|
+
|
|
16
|
+
# .env
|
|
17
|
+
cat .env | pick DATABASE_URL
|
|
18
|
+
# postgres://localhost:5432/mydb
|
|
19
|
+
|
|
20
|
+
# YAML
|
|
21
|
+
cat config.yaml | pick server.port
|
|
22
|
+
# 8080
|
|
23
|
+
|
|
24
|
+
# TOML
|
|
25
|
+
cat Cargo.toml | pick package.version
|
|
26
|
+
# 0.1.0
|
|
27
|
+
|
|
28
|
+
# HTTP headers
|
|
29
|
+
curl -sI https://example.com | pick content-type
|
|
30
|
+
# text/html; charset=UTF-8
|
|
31
|
+
|
|
32
|
+
# logfmt
|
|
33
|
+
echo 'level=info msg="request handled" status=200' | pick status
|
|
34
|
+
# 200
|
|
35
|
+
|
|
36
|
+
# CSV
|
|
37
|
+
cat data.csv | pick '[0].name'
|
|
38
|
+
# Alice
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Selectors
|
|
42
|
+
|
|
43
|
+
| Syntax | Description |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `foo` | Top-level key |
|
|
46
|
+
| `foo.bar` | Nested key |
|
|
47
|
+
| `foo[0]` | Array index |
|
|
48
|
+
| `foo[-1]` | Last element |
|
|
49
|
+
| `foo[*].name` | All elements, pluck field |
|
|
50
|
+
| `[0]` | Index into root array |
|
|
51
|
+
| `"dotted.key".sub` | Quoted key (for keys containing dots) |
|
|
52
|
+
|
|
53
|
+
## Flags
|
|
54
|
+
|
|
55
|
+
| Flag | Description |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `-i, --input <format>` | Force input format |
|
|
58
|
+
| `-f, --file <path>` | Read from file instead of stdin |
|
|
59
|
+
| `--json` | Output as JSON |
|
|
60
|
+
| `-1, --first` | Only first result |
|
|
61
|
+
| `--lines` | One element per line |
|
|
62
|
+
| `-d, --default <value>` | Fallback value |
|
|
63
|
+
| `-e, --exists` | Check if selector matches (exit code only) |
|
|
64
|
+
| `-c, --count` | Count matches |
|
|
65
|
+
|
|
66
|
+
## Supported Formats
|
|
67
|
+
|
|
68
|
+
JSON, YAML, TOML, .env, HTTP headers, logfmt, CSV/TSV, and plain text. Format is auto-detected — use `-i` to override.
|
|
69
|
+
|
|
70
|
+
## Links
|
|
71
|
+
|
|
72
|
+
- [Documentation & examples](https://pick-cli.pages.dev)
|
|
73
|
+
- [GitHub](https://github.com/aryanbhosale/pick)
|
|
74
|
+
- [Issues](https://github.com/aryanbhosale/pick/issues)
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aryanbhosale/pick",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Extract values from anything — JSON, YAML, TOML, .env, HTTP headers, logfmt, CSV, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"bin"
|
|
28
28
|
],
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@aryanbhosale/pick-darwin-arm64": "0.1.
|
|
31
|
-
"@aryanbhosale/pick-darwin-x64": "0.1.
|
|
32
|
-
"@aryanbhosale/pick-linux-x64": "0.1.
|
|
33
|
-
"@aryanbhosale/pick-linux-arm64": "0.1.
|
|
34
|
-
"@aryanbhosale/pick-win32-x64": "0.1.
|
|
30
|
+
"@aryanbhosale/pick-darwin-arm64": "0.1.1",
|
|
31
|
+
"@aryanbhosale/pick-darwin-x64": "0.1.1",
|
|
32
|
+
"@aryanbhosale/pick-linux-x64": "0.1.1",
|
|
33
|
+
"@aryanbhosale/pick-linux-arm64": "0.1.1",
|
|
34
|
+
"@aryanbhosale/pick-win32-x64": "0.1.1"
|
|
35
35
|
}
|
|
36
36
|
}
|