Skip to content

Commit 4a2c8b4

Browse files
committed
Add show-link option
1 parent b856644 commit 4a2c8b4

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rbmenu"
3-
version = "0.6.1"
3+
version = "0.6.2"
44
authors = ["DevHyperCoder <[email protected]>"]
55
edition = "2018"
66
description = "Rust Bookmark (d)Menu"

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ Yes, more features are on the way. Some planned ones are, groups for bookmarks
3535

3636
## CLI - Options
3737

38-
| Option / Flags | Description |
39-
| ---------------- | -------------------------- |
40-
| `-h` `--help` | Prints help information |
41-
| `-V` | Prints version information |
42-
| `-n` `--name` | Name of the bookmark |
43-
| `-i` `--id` | Id of the bookmark |
44-
| `-u` `--url` | Url of the bookmark |
38+
| Option / Flags | Description |
39+
| ------------------ | -------------------------- |
40+
| `-h` `--help` | Prints help information |
41+
| `-V` | Prints version information |
42+
| `-n` `--name` | Name of the bookmark |
43+
| `-i` `--id` | Id of the bookmark |
44+
| `-u` `--url` | Url of the bookmark |
45+
| `-l` `--show-link` | Show link of the bookmark |
4546

4647
## CLI - Subcommands
4748

@@ -69,6 +70,10 @@ Without the name option, `rbmenu list` displays all the available bookmarks. Giv
6970

7071
`rbmenu list -n "git*"`
7172

73+
To just get the link of a bookmark, use the `-l` option.
74+
75+
`rbmenu list -n "git*" -l` will return just the links of the bookmarks.
76+
7277
**Remove Bookmark**
7378

7479
- `-n` is the name of the bookmark.

src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ pub enum SubOpt {
4545
},
4646
#[structopt(alias = "ls")]
4747
List {
48+
/// Show only the link of the bookmark
49+
#[structopt(global = true, short = "l", long = "show-link")]
50+
show_link: bool,
51+
4852
#[structopt(flatten)]
4953
query: BookmarkQuery,
5054
},

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ pub fn run() -> Result<()> {
4949
i.colored_fmt()
5050
}
5151
}
52-
SubOpt::List { query } => {
52+
SubOpt::List { query, show_link } => {
5353
let listed = list(&data, query)?;
5454
for i in listed {
55-
i.colored_fmt()
55+
if show_link {
56+
println!("{}", i.link);
57+
} else {
58+
i.colored_fmt()
59+
}
5660
}
5761
}
5862
SubOpt::Update { query } => update(&mut data, query)?,

0 commit comments

Comments
 (0)