Skip to content

Commit

Permalink
Create a manpage
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
brianm committed Feb 4, 2017
1 parent 2874b21 commit 7008ca2
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.bk
target
*.1
2 changes: 1 addition & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "jp"
version = "0.3.0"
authors = ["Brian McCallister <[email protected]>"]
build = "build.rs"

[dependencies]
serde_json = "0.9"
Expand Down
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use std::process::Command;

fn main() {
Command::new("pandoc").args(&["jp.1.md", "-s", "-t", "man", "-o", "target/jp.1"])
.status()
.unwrap();
}
54 changes: 54 additions & 0 deletions jp.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
% JP(1)
% Brian McCallister <[email protected]>

# NAME

jp - Extract values from JSON (or a stream of JSON values) via JSON Pointers

# SYNOPSIS

**jp** [*OPTIONS*] <*POINTER*>...

# FLAGS

**-h**, **--help**
: Prints help information

**-V**, **--version**
: Prints version information

# OPTIONS

**-d**, **--delimiter** <*DELIMITER*>
: delimiter between output values, default is tab

**-i**, **--input** <*INPUT*>
: input file to use if not receiving on stdin

# DESCRIPTION

Accepts a stream of JSON values, applying the JSON Pointers passed on the command line to
each value, and printing out matches, one line per JSON value. Matched values will seperated
by the configured delimiter, which is tab by default.

# RESOURCES

Source
: <https://github.com/brianm/jp/>

# COPYING

Copyright 2017 Brian McCallister

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn render(v: &Value) -> String {
&Value::Null => String::new(),
&Value::Bool(ref b) => format!("{}", b),
&Value::Number(ref b) => format!("{}", b),
&Value::String(ref s) => format!("{}", s),
&Value::String(_ /*ref s*/) => format!("{}", v),
&Value::Array(_) => format!("{}", v),
&Value::Object(_) => format!("{}", v),
}
Expand Down

0 comments on commit 7008ca2

Please sign in to comment.