cli: Don't show patch diff by default
It can be re-enabled with `-p`, which is what git uses usually.
This commit is contained in:
parent
04e95b45fc
commit
6f17a4db67
|
|
@ -48,7 +48,7 @@ $ rad patch
|
||||||
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
```
|
```
|
||||||
$ rad patch show 191a14e520f2eeff7c0e3ee0a5523c5217eecb89
|
$ rad patch show 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 -p
|
||||||
╭─────────────────────────────────────────────────────────────────────────────────────────╮
|
╭─────────────────────────────────────────────────────────────────────────────────────────╮
|
||||||
│ Title Define power requirements │
|
│ Title Define power requirements │
|
||||||
│ Patch 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 │
|
│ Patch 191a14e520f2eeff7c0e3ee0a5523c5217eecb89 │
|
||||||
|
|
|
||||||
|
|
@ -57,17 +57,6 @@ $ rad patch show a07ef7743a32a2e902672ea3526d1db6ee08108a
|
||||||
├─────────────────────────────────────────────────────────────────────────────────────────┤
|
├─────────────────────────────────────────────────────────────────────────────────────────┤
|
||||||
│ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (you) [.. ]│
|
│ ● opened by did:key:z6Mkt67GdsW7715MEfRuP4pSZxJRJh6kj6Y48WRqVv4N1tRk (you) [.. ]│
|
||||||
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
╰─────────────────────────────────────────────────────────────────────────────────────────╯
|
||||||
|
|
||||||
commit 3e674d1a1df90807e934f9ae5da2591dd6848a33
|
|
||||||
Author: radicle <radicle@localhost>
|
|
||||||
Date: Thu Dec 15 17:28:04 2022 +0000
|
|
||||||
|
|
||||||
Define power requirements
|
|
||||||
|
|
||||||
diff --git a/REQUIREMENTS b/REQUIREMENTS
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..e69de29
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Wait, let's add a README too! Just for fun.
|
Wait, let's add a README too! Just for fun.
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,10 @@ Usage
|
||||||
rad patch checkout <patch-id> [<option>...]
|
rad patch checkout <patch-id> [<option>...]
|
||||||
rad patch delete <patch-id> [<option>...]
|
rad patch delete <patch-id> [<option>...]
|
||||||
|
|
||||||
|
Show options
|
||||||
|
|
||||||
|
-p, --patch Show the actual patch diff
|
||||||
|
|
||||||
Create/Update options
|
Create/Update options
|
||||||
|
|
||||||
--[no-]announce Announce patch to network (default: false)
|
--[no-]announce Announce patch to network (default: false)
|
||||||
|
|
@ -84,6 +88,7 @@ pub enum Operation {
|
||||||
},
|
},
|
||||||
Show {
|
Show {
|
||||||
patch_id: Rev,
|
patch_id: Rev,
|
||||||
|
diff: bool,
|
||||||
},
|
},
|
||||||
Update {
|
Update {
|
||||||
patch_id: Option<Rev>,
|
patch_id: Option<Rev>,
|
||||||
|
|
@ -125,6 +130,7 @@ impl Args for Options {
|
||||||
let mut message = Message::default();
|
let mut message = Message::default();
|
||||||
let mut push = true;
|
let mut push = true;
|
||||||
let mut filter = Some(patch::State::Open);
|
let mut filter = Some(patch::State::Open);
|
||||||
|
let mut diff = false;
|
||||||
|
|
||||||
while let Some(arg) = parser.next()? {
|
while let Some(arg) = parser.next()? {
|
||||||
match arg {
|
match arg {
|
||||||
|
|
@ -158,6 +164,11 @@ impl Args for Options {
|
||||||
push = false;
|
push = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show options.
|
||||||
|
Long("patch") | Short('p') if op == Some(OperationName::Show) => {
|
||||||
|
diff = true;
|
||||||
|
}
|
||||||
|
|
||||||
// List options.
|
// List options.
|
||||||
Long("all") => {
|
Long("all") => {
|
||||||
filter = None;
|
filter = None;
|
||||||
|
|
@ -205,6 +216,7 @@ impl Args for Options {
|
||||||
OperationName::List => Operation::List { filter },
|
OperationName::List => Operation::List { filter },
|
||||||
OperationName::Show => Operation::Show {
|
OperationName::Show => Operation::Show {
|
||||||
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
||||||
|
diff,
|
||||||
},
|
},
|
||||||
OperationName::Delete => Operation::Delete {
|
OperationName::Delete => Operation::Delete {
|
||||||
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
patch_id: patch_id.ok_or_else(|| anyhow!("a patch must be provided"))?,
|
||||||
|
|
@ -249,9 +261,9 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
|
||||||
Operation::List { filter } => {
|
Operation::List { filter } => {
|
||||||
list::run(&repository, &profile, Some(workdir), filter)?;
|
list::run(&repository, &profile, Some(workdir), filter)?;
|
||||||
}
|
}
|
||||||
Operation::Show { patch_id } => {
|
Operation::Show { patch_id, diff } => {
|
||||||
let patch_id = patch_id.resolve(&repository.backend)?;
|
let patch_id = patch_id.resolve(&repository.backend)?;
|
||||||
show::run(&profile, &repository, &workdir, &patch_id)?;
|
show::run(&profile, &repository, &workdir, &patch_id, diff)?;
|
||||||
}
|
}
|
||||||
Operation::Update {
|
Operation::Update {
|
||||||
ref patch_id,
|
ref patch_id,
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ pub fn run(
|
||||||
// TODO: Should be optional.
|
// TODO: Should be optional.
|
||||||
workdir: &git::raw::Repository,
|
workdir: &git::raw::Repository,
|
||||||
patch_id: &PatchId,
|
patch_id: &PatchId,
|
||||||
|
diff: bool,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let patches = patch::Patches::open(stored)?;
|
let patches = patch::Patches::open(stored)?;
|
||||||
let Some(patch) = patches.get(patch_id)? else {
|
let Some(patch) = patches.get(patch_id)? else {
|
||||||
|
|
@ -91,10 +92,11 @@ pub fn run(
|
||||||
widget.push(line);
|
widget.push(line);
|
||||||
}
|
}
|
||||||
widget.print();
|
widget.print();
|
||||||
term::blank();
|
|
||||||
|
|
||||||
show_patch_diff(&patch, stored, workdir)?;
|
|
||||||
term::blank();
|
|
||||||
|
|
||||||
|
if diff {
|
||||||
|
term::blank();
|
||||||
|
show_patch_diff(&patch, stored, workdir)?;
|
||||||
|
term::blank();
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue