#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Row {
Text(usize),
Save,
Field(Field),
Template(String),
Templates,
Labels,
Assignees,
Milestone,
Base,
Head,
Push,
Tag,
Target,
Notes,
Prerelease,
Latest,
Description,
Rename(usize),
Remove(usize),
AddFile,
Ref,
Input(String),
New,
}
impl Row {
pub fn describe(&self) -> &'static str {
match self {
Row::Text(_) => "Write it in the composer",
Row::Save => "Save it",
Row::Field(field) => field.describe(),
Row::Template(file) if file.is_empty() => "Start a blank issue",
Row::Template(_) => "Start from this template",
Row::Templates => "Choose another template",
Row::Labels => "Choose labels",
Row::Assignees => "Choose assignees",
Row::Milestone => "Choose a milestone",
Row::Base => "Choose the branch to merge into",
Row::Head => "Choose the branch with the changes",
Row::Push => "Push the branch to GitHub",
Row::Tag => "Choose a tag, or make one",
Row::Target => "Choose the branch or commit to tag",
Row::Notes => "Have GitHub write the release notes",
Row::Prerelease => "Mark it a pre-release, or not",
Row::Latest => "Make it the latest release, or not",
Row::Description => "Write the gist's description",
Row::Rename(_) => "Rename the file",
Row::Remove(_) => "Remove the file",
Row::AddFile => "Add a file",
Row::Ref => "Choose the branch it runs on",
Row::Input(_) => "Set the input",
Row::New => "New label",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum Field {
Name,
Colour,
Description,
Title,
Due,
Owner,
Private,
Readme,
Gitignore,
License,
AllBranches,
Path,
Branch,
Message,
}
impl Field {
pub fn name(self) -> &'static str {
match self {
Field::Name => "Name",
Field::Colour => "Colour",
Field::Description => "Description",
Field::Title => "Title",
Field::Due => "Due date",
Field::Owner => "Owner",
Field::Private => "Visibility",
Field::Readme => "README",
Field::Gitignore => ".gitignore",
Field::License => "Licence",
Field::AllBranches => "Branches",
Field::Path => "Path",
Field::Branch => "Commit to",
Field::Message => "Message",
}
}
pub fn toggles(self) -> bool {
matches!(self, Field::Private | Field::Readme | Field::AllBranches)
}
fn describe(self) -> &'static str {
match self {
Field::Private => "Make it public or private",
Field::Readme => "Add a README, or not",
Field::AllBranches => "Copy all branches, or the default one",
Field::Owner => "Choose the owner",
Field::Colour => "Choose the colour",
Field::Due => "Set the due date",
Field::Gitignore => "Choose a .gitignore template",
Field::License => "Choose a licence",
Field::Path => "Name the file, or move it",
Field::Branch => "Choose the branch to commit to",
Field::Message => "Write the commit message",
Field::Name | Field::Title => "Name it",
Field::Description => "Describe it",
}
}
}