cli: Add `--seeds` option to `ls`
Small addition that is useful.
This commit is contained in:
parent
71bba29c9a
commit
0a3da17fad
|
|
@ -65,7 +65,7 @@ Date: Mon Jan 1 14:39:16 2018 +0000
|
||||||
|
|
||||||
Cloned repositories show up in `rad ls`:
|
Cloned repositories show up in `rad ls`:
|
||||||
```
|
```
|
||||||
$ rad ls --all
|
$ rad ls --seeds
|
||||||
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ Name RID Visibility Head Description │
|
│ Name RID Visibility Head Description │
|
||||||
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ Now, if we run `rad ls`, we see it's gone:
|
||||||
```
|
```
|
||||||
$ rad ls
|
$ rad ls
|
||||||
Nothing to show.
|
Nothing to show.
|
||||||
|
$ rad ls --seeds
|
||||||
|
Nothing to show.
|
||||||
```
|
```
|
||||||
|
|
||||||
However, with the `--all` flag, we can see it still, but as local-only:
|
However, with the `--all` flag, we can see it still, but as local-only:
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@ Options
|
||||||
|
|
||||||
--private Show only private repositories
|
--private Show only private repositories
|
||||||
--public Show only public repositories
|
--public Show only public repositories
|
||||||
--all Show all repositories in storage
|
--seeds, -s Show all seeded repositories
|
||||||
|
--all, -a Show all repositories in storage
|
||||||
--verbose, -v Verbose output
|
--verbose, -v Verbose output
|
||||||
--help Print help
|
--help Print help
|
||||||
"#,
|
"#,
|
||||||
|
|
@ -35,6 +36,7 @@ pub struct Options {
|
||||||
public: bool,
|
public: bool,
|
||||||
private: bool,
|
private: bool,
|
||||||
all: bool,
|
all: bool,
|
||||||
|
seeds: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Args for Options {
|
impl Args for Options {
|
||||||
|
|
@ -46,15 +48,19 @@ impl Args for Options {
|
||||||
let mut private = false;
|
let mut private = false;
|
||||||
let mut public = false;
|
let mut public = false;
|
||||||
let mut all = false;
|
let mut all = false;
|
||||||
|
let mut seeds = false;
|
||||||
|
|
||||||
while let Some(arg) = parser.next()? {
|
while let Some(arg) = parser.next()? {
|
||||||
match arg {
|
match arg {
|
||||||
Long("help") | Short('h') => {
|
Long("help") | Short('h') => {
|
||||||
return Err(Error::Help.into());
|
return Err(Error::Help.into());
|
||||||
}
|
}
|
||||||
Long("all") => {
|
Long("all") | Short('a') => {
|
||||||
all = true;
|
all = true;
|
||||||
}
|
}
|
||||||
|
Long("seeds") | Short('s') => {
|
||||||
|
seeds = true;
|
||||||
|
}
|
||||||
Long("private") => {
|
Long("private") => {
|
||||||
private = true;
|
private = true;
|
||||||
}
|
}
|
||||||
|
|
@ -72,6 +78,7 @@ impl Args for Options {
|
||||||
private,
|
private,
|
||||||
public,
|
public,
|
||||||
all,
|
all,
|
||||||
|
seeds,
|
||||||
},
|
},
|
||||||
vec![],
|
vec![],
|
||||||
))
|
))
|
||||||
|
|
@ -103,7 +110,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
if !doc.visibility.is_public() && !options.private && options.public {
|
if !doc.visibility.is_public() && !options.private && options.public {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if refs.is_none() && !options.all {
|
if refs.is_none() && !options.all && !options.seeds {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let seeded = policy.is_seeding(&rid)?;
|
let seeded = policy.is_seeding(&rid)?;
|
||||||
|
|
@ -111,6 +118,9 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
if !seeded && !options.all {
|
if !seeded && !options.all {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if !seeded && options.seeds {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let proj = doc.project()?;
|
let proj = doc.project()?;
|
||||||
let head = term::format::oid(head).into();
|
let head = term::format::oid(head).into();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue