hive-forge: add --label to issue-create and pr-create
This commit is contained in:
parent
c236c16c52
commit
abde71b0ed
4 changed files with 94 additions and 9 deletions
|
|
@ -91,7 +91,10 @@ pub fn run(client: &Client, args: Args) -> Result<()> {
|
|||
}
|
||||
|
||||
/// First page (100) of the repo's label set, for name → id resolution.
|
||||
fn repo_labels(client: &Client) -> Result<Vec<Label>> {
|
||||
/// `pub(crate)` so other creation verbs (`issue-create`, `pr-create`) can
|
||||
/// resolve a `--label` name to the id the create-payload structs need
|
||||
/// without duplicating the lookup.
|
||||
pub(crate) fn repo_labels(client: &Client) -> Result<Vec<Label>> {
|
||||
let (owner, name) = client.owner_repo()?;
|
||||
let (_, labels) = client
|
||||
.api()
|
||||
|
|
@ -101,7 +104,10 @@ fn repo_labels(client: &Client) -> Result<Vec<Label>> {
|
|||
Ok(labels)
|
||||
}
|
||||
|
||||
fn resolve_ids(all: &[Label], names: &[String]) -> Vec<i64> {
|
||||
/// Resolve label names to ids, silently dropping any name that doesn't
|
||||
/// match a repo label (same behavior as `labels add`/`remove` above —
|
||||
/// keeps this one non-fatal-typo policy in one place).
|
||||
pub(crate) fn resolve_ids(all: &[Label], names: &[String]) -> Vec<i64> {
|
||||
names.iter().filter_map(|n| lookup_id(all, n)).collect()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue