(dd8a0c9) Add git user as default owner
This commit is contained in:
@@ -39,3 +39,4 @@ Tests create temporary `.worklane` directories with all four status folders pre-
|
||||
- When working on a ticket use `worklane show [ticketID]` to read the ticket.
|
||||
- If the ticket is in the backlog, move it to committed using `worklane mv --status committed [ticketID]`.
|
||||
- When your changes meet the acceptance criteria and the code compiles, move the ticket to reviewing using `worklane mv --status reviewing [ticketID]`
|
||||
- If you need more information on how to use `worklane`, use the worklane kanban skill
|
||||
|
||||
+21
@@ -250,6 +250,23 @@ fn cmd_ls(status_filter: &Option<String>, worklane_dir: &Path) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_git_user() -> Option<String> {
|
||||
std::process::Command::new("git")
|
||||
.args(&["config", "user.name"])
|
||||
.output()
|
||||
.ok()
|
||||
.and_then(|out| {
|
||||
if out.status.success() {
|
||||
String::from_utf8(out.stdout)
|
||||
.ok()
|
||||
.map(|s| s.trim().to_string())
|
||||
.filter(|s| !s.is_empty())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn cmd_add(
|
||||
title: &str,
|
||||
description: &Option<String>,
|
||||
@@ -260,6 +277,10 @@ fn cmd_add(
|
||||
owner: &Option<String>,
|
||||
start: &Path,
|
||||
) -> Result<()> {
|
||||
let owner = match owner {
|
||||
Some(o) => Some(o.clone()),
|
||||
None => get_git_user(),
|
||||
};
|
||||
let worklane_dir = find_worklane_dir(start)?;
|
||||
let backlog_dir = worklane_dir.join("backlog");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user