@@ -23,6 +23,9 @@ use self::new::NewArgs;
|
|||||||
use super::{CliOptions, CommandRunner};
|
use super::{CliOptions, CommandRunner};
|
||||||
use crate::error::N34Result;
|
use crate::error::N34Result;
|
||||||
|
|
||||||
|
/// Prefix used for git issue alt.
|
||||||
|
pub const ISSUE_ALT_PREFIX: &str = "git issue: ";
|
||||||
|
|
||||||
#[derive(Subcommand, Debug)]
|
#[derive(Subcommand, Debug)]
|
||||||
pub enum IssueSubcommands {
|
pub enum IssueSubcommands {
|
||||||
/// Create a new repository issue
|
/// Create a new repository issue
|
||||||
|
|||||||
@@ -15,15 +15,15 @@
|
|||||||
// along with this program. If not, see <https://gnu.org/licenses/gpl-3.0.html>.
|
// along with this program. If not, see <https://gnu.org/licenses/gpl-3.0.html>.
|
||||||
|
|
||||||
/// `issue` subcommands
|
/// `issue` subcommands
|
||||||
mod issue;
|
pub mod issue;
|
||||||
/// `patch` subcommands
|
/// `patch` subcommands
|
||||||
mod patch;
|
pub mod patch;
|
||||||
/// 'reply` command
|
/// 'reply` command
|
||||||
mod reply;
|
pub mod reply;
|
||||||
/// `repo` subcommands
|
/// `repo` subcommands
|
||||||
mod repo;
|
pub mod repo;
|
||||||
/// `sets` subcommands
|
/// `sets` subcommands
|
||||||
mod sets;
|
pub mod sets;
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
// along with this program. If not, see <https://gnu.org/licenses/gpl-3.0.html>.
|
// along with this program. If not, see <https://gnu.org/licenses/gpl-3.0.html>.
|
||||||
|
|
||||||
/// Command line interface module
|
/// Command line interface module
|
||||||
mod cli;
|
pub mod cli;
|
||||||
/// N34 errors
|
/// N34 errors
|
||||||
mod error;
|
pub mod error;
|
||||||
/// Nostr utils module
|
/// Nostr utils module
|
||||||
mod nostr_utils;
|
pub mod nostr_utils;
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
process::ExitCode,
|
process::ExitCode,
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ use nostr::{
|
|||||||
types::{RelayUrl, Url},
|
types::{RelayUrl, Url},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::cli::issue::ISSUE_ALT_PREFIX;
|
||||||
use crate::error::{N34Error, N34Result};
|
use crate::error::{N34Error, N34Result};
|
||||||
|
|
||||||
|
|
||||||
@@ -115,13 +116,20 @@ impl EventBuilder {
|
|||||||
subject: Option<String>,
|
subject: Option<String>,
|
||||||
labels: Vec<String>,
|
labels: Vec<String>,
|
||||||
) -> N34Result<EventBuilder> {
|
) -> N34Result<EventBuilder> {
|
||||||
EventBuilder::git_issue(GitIssue {
|
let mut event_builder = EventBuilder::git_issue(GitIssue {
|
||||||
repository,
|
repository,
|
||||||
content,
|
content,
|
||||||
subject,
|
subject: subject.clone(),
|
||||||
labels: labels.into_iter().map(|l| l.trim().to_owned()).collect(),
|
labels: labels.into_iter().map(|l| l.trim().to_owned()).collect(),
|
||||||
})
|
})
|
||||||
.map_err(N34Error::from)
|
.map_err(N34Error::from)?;
|
||||||
|
|
||||||
|
if let Some(issue_subject) = subject {
|
||||||
|
event_builder =
|
||||||
|
event_builder.tag(Tag::alt(format!("{ISSUE_ALT_PREFIX}{issue_subject}")))
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(event_builder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user