Skip to content

Commit

Permalink
make json-to-go.js directly executable
Browse files Browse the repository at this point in the history
  • Loading branch information
grische committed Jul 26, 2024
1 parent bfc29a7 commit 3647948
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ Contributions are welcome! Open a pull request to fix a bug, or open an issue to
node json-to-go.js sample.json
```

- Read JSON file on Unix systems:

```sh
./json-to-go.js sample.json
```

- Read JSON file from stdin:

```sh
node json-to-go.js < sample.json
cat sample.json | node json-to-go.js
./json-to-go.js < sample.json
cat sample.json | ./json-to-go.js
```

- For more options, check the help page

```sh
node json-to-go.js --help
./json-to-go.js --help
```

### Credits
Expand Down
3 changes: 2 additions & 1 deletion json-to-go-v2.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env node
/*
JSON-to-Go v2
by Matt Holt
Expand Down Expand Up @@ -514,7 +515,7 @@ if (typeof module === 'undefined' || !module.parent) {
const scriptname = path.basename(process.argv[1])

console.log(`\
Usage: node ${scriptname} [OPTION]... [FILE]
Usage: ${scriptname} [OPTION]... [FILE]
Convert json to go file and prints the result on stdout.
Optional arguments:
Expand Down
1 change: 1 addition & 0 deletions json-to-go.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env node
/*
JSON-to-Go
by Matt Holt
Expand Down

0 comments on commit 3647948

Please sign in to comment.