Skip to content

Commit

Permalink
better cli usability
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Kowallik committed Feb 22, 2024
1 parent 09aa1a4 commit 6ced3d1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# tmconfjs

**tmconfjs** parses a single tmconf file (eg. `/config/bigip.conf`) and writes the JSON representation to `STDOUT`.
**tmconfjs** provides a simple parser (`tmconfparse` command) to serialize a tmconf file (eg. `/config/bigip.conf`) to JSON. The produced JSON is printed to `STDOUT`.

This project is (supposed to be) a minimal wrapper and vendors the necessary code from the community project [F5 BIG-IP Automation Config Converter (BIG-IP ACC)](https://github.com/f5devcentral/f5-automation-config-converter/).

## Usage example

```shell
$ node tmconfparse.js example/test.tmconf 2>/dev/null | jq '."ltm profile client-ssl clientssl-secure"'
$ npm install -g https://github.com/simonkowallik/tmconfjs
```

```shell
$ tmconfparse example/test.tmconf 2>/dev/null | jq '."ltm profile client-ssl clientssl-secure"'
```

```json
Expand Down Expand Up @@ -37,7 +41,8 @@ $ node tmconfparse.js example/test.tmconf 2>/dev/null | jq '."ltm profile client
Any errors or info is written to `STDERR`.

```shell
$ node tmconfparse.js example/test.tmconf >/dev/null
# run node and tmconfparse.js as first argument followed by tmconfparse arguments.
$ node ./tmconfparse.js example/test.tmconf >/dev/null
Debugger attached.
2024-02-17 00:29:17 WARN UNRECOGNIZED LINE: ' auto-check enabled'
2024-02-17 00:29:17 WARN UNRECOGNIZED LINE: ' auto-phonehome enabled'
Expand Down
3 changes: 3 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"bin": {
"tmconfparse": "./tmconfparse.js"
},
"keywords": ["F5", "tmconf", "parse", "JSON", "BIG-IP"],
"author": "Simon Kowallik",
"license": "Apache License 2.0",
Expand Down
2 changes: 2 additions & 0 deletions tmconfparse.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

"use strict";

const parser = require("./vendored/engines/parser");
Expand Down

0 comments on commit 6ced3d1

Please sign in to comment.