Skip to content

Commit

Permalink
Fix usage text
Browse files Browse the repository at this point in the history
  • Loading branch information
sayanarijit committed May 24, 2023
1 parent e144c97 commit 96a8fcc
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
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.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "jf"
version = "0.3.2"
version = "0.3.3"
edition = "2021"
authors = ["Arijit Basu <[email protected]>"]
description = 'A small utility to safely format and print JSON objects in the commandline'
Expand Down
21 changes: 12 additions & 9 deletions assets/jf.1
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,39 @@ And [VALUE]\.\.\. [NAME=VALUE]\.\.\. are the values for the placeholders.
.TP
.B
`%s`
`%q` posiitonal placeholder
`%q` posiitonal placeholder
.TP
.B
`%(NAME)s`
`%(NAME)q` named placeholder
`%(NAME=DEFAULT)s` `%(NAME=DEFAULT)q` placeholder with default value
`%(NAME)q` named placeholder
.TP
.B
`%(NAME=DEFAULT)s`
`%(NAME=DEFAULT)q` placeholder with default value
.TP
.B
`%(NAME?)s`
`%(NAME?)q` optional placeholder that defaults to `null`
`%(NAME?)q` nullable placeholder that defaults to `null`
.TP
.B
`%(NAME)?s`
`%(NAME)?q` nullable placeholder that defaults to blank
`%(NAME)?q` optional placeholder that defaults to blank
.TP
.B
`%*s`
`%*q` expand positional values as array items
`%*q` expand positional values as array items
.TP
.B
`%**s`
`%**q` expand positional values as key value pairs
`%**q` expand positional values as key value pairs
.TP
.B
`%(NAME)*s`
`%(NAME)*q` expand named values as array items
`%(NAME)*q` expand named values as array items
.TP
.B
`%(NAME)**s`
`%(NAME)**q` expand named values as key value pairs
`%(NAME)**q` expand named values as key value pairs
.SH RULES

.IP \(bu 3
Expand Down
4 changes: 2 additions & 2 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,14 @@ fn test_usage_example() {
#[test]
fn test_print_version() {
let arg = ["jf v%v"].map(Into::into);
assert_eq!(jf::format(arg).unwrap().to_string(), r#""jf v0.3.2""#);
assert_eq!(jf::format(arg).unwrap().to_string(), r#""jf v0.3.3""#);

let args =
["{foo: %q, bar: %(bar)q, version: %v}", "foo", "bar=bar"].map(Into::into);

assert_eq!(
jf::format(args).unwrap().to_string(),
r#"{"foo":"foo","bar":"bar","version":"0.3.2"}"#
r#"{"foo":"foo","bar":"bar","version":"0.3.3"}"#
);
}

Expand Down
18 changes: 9 additions & 9 deletions src/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ USAGE

SYNTAX

`%s` `%q` posiitonal placeholder
`%(NAME)s` `%(NAME)q` named placeholder
`%(NAME=DEFAULT)s` `%(NAME=DEFAULT)q` placeholder with default value
`%(NAME?)s` `%(NAME?)q` optional placeholder that defaults to `null`
`%(NAME)?s` `%(NAME)?q` nullable placeholder that defaults to blank
`%*s` `%*q` expand positional values as array items
`%**s` `%**q` expand positional values as key value pairs
`%(NAME)*s` `%(NAME)*q` expand named values as array items
`%(NAME)**s` `%(NAME)**q` expand named values as key value pairs
`%s` `%q` posiitonal placeholder
`%(NAME)s` `%(NAME)q` named placeholder
`%(NAME=DEFAULT)s` `%(NAME=DEFAULT)q` placeholder with default value
`%(NAME?)s` `%(NAME?)q` nullable placeholder that defaults to `null`
`%(NAME)?s` `%(NAME)?q` optional placeholder that defaults to blank
`%*s` `%*q` expand positional values as array items
`%**s` `%**q` expand positional values as key value pairs
`%(NAME)*s` `%(NAME)*q` expand named values as array items
`%(NAME)**s` `%(NAME)**q` expand named values as key value pairs

RULES

Expand Down

0 comments on commit 96a8fcc

Please sign in to comment.