@jacebenson/jsn 3.1.1 → 3.1.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -71,6 +71,19 @@ Pick the most specific tool for the job. **Never default to eval** — it's the
71
71
  | **Config** | `setup`, `auth`, `profiles`, `updatesets`, `scopes` |
72
72
  | **Developer** | `eval`, `rest`, `skill`, `version` |
73
73
 
74
+ ### `jsn rest` examples
75
+
76
+ ```bash
77
+ # Query any table by name
78
+ jsn rest --table incident --query "active=true" --limit 5 --json
79
+
80
+ # GET a single record
81
+ jsn rest --table incident --sys-id abc123... --json
82
+
83
+ # Raw endpoint access
84
+ jsn rest "/api/now/table/incident?sysparm_limit=3" --json
85
+ ```
86
+
74
87
  ## Troubleshooting Field Behavior
75
88
 
76
89
  Check order (priority):
package/src/cli.js CHANGED
@@ -150,7 +150,7 @@ export function buildCLI() {
150
150
  if (argv.styled) argv.format = 'styled';
151
151
  if (argv.markdown) argv.format = 'markdown';
152
152
  if (argv.format) {
153
- app.output.setFormatByName(argv.format);
153
+ app.output.setFormat(argv.format);
154
154
  }
155
155
  if (argv.instance) {
156
156
  app._overrideInstance = argv.instance;
package/src/output.js CHANGED
@@ -39,6 +39,11 @@ export class OutputWriter {
39
39
  return this.format;
40
40
  }
41
41
 
42
+ setFormat(name) {
43
+ this.format = name;
44
+ return this;
45
+ }
46
+
42
47
  effectiveFormat() {
43
48
  if (this.format === FormatAuto) {
44
49
  return isTTY(this.writer) ? FormatStyled : FormatJSON;