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`:
|
||||
```
|
||||
$ rad ls --all
|
||||
$ rad ls --seeds
|
||||
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ Name RID Visibility Head Description │
|
||||
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ Now, if we run `rad ls`, we see it's gone:
|
|||
```
|
||||
$ rad ls
|
||||
Nothing to show.
|
||||
$ rad ls --seeds
|
||||
Nothing to show.
|
||||
```
|
||||
|
||||
However, with the `--all` flag, we can see it still, but as local-only:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ Options
|
|||
|
||||
--private Show only private 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
|
||||
--help Print help
|
||||
"#,
|
||||
|
|
@ -35,6 +36,7 @@ pub struct Options {
|
|||
public: bool,
|
||||
private: bool,
|
||||
all: bool,
|
||||
seeds: bool,
|
||||
}
|
||||
|
||||
impl Args for Options {
|
||||
|
|
@ -46,15 +48,19 @@ impl Args for Options {
|
|||
let mut private = false;
|
||||
let mut public = false;
|
||||
let mut all = false;
|
||||
let mut seeds = false;
|
||||
|
||||
while let Some(arg) = parser.next()? {
|
||||
match arg {
|
||||
Long("help") | Short('h') => {
|
||||
return Err(Error::Help.into());
|
||||
}
|
||||
Long("all") => {
|
||||
Long("all") | Short('a') => {
|
||||
all = true;
|
||||
}
|
||||
Long("seeds") | Short('s') => {
|
||||
seeds = true;
|
||||
}
|
||||
Long("private") => {
|
||||
private = true;
|
||||
}
|
||||
|
|
@ -72,6 +78,7 @@ impl Args for Options {
|
|||
private,
|
||||
public,
|
||||
all,
|
||||
seeds,
|
||||
},
|
||||
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 {
|
||||
continue;
|
||||
}
|
||||
if refs.is_none() && !options.all {
|
||||
if refs.is_none() && !options.all && !options.seeds {
|
||||
continue;
|
||||
}
|
||||
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 {
|
||||
continue;
|
||||
}
|
||||
if !seeded && options.seeds {
|
||||
continue;
|
||||
}
|
||||
let proj = doc.project()?;
|
||||
let head = term::format::oid(head).into();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue