#[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",
}
}
}
words! {
#[derive(Hash, PartialOrd, Ord)]
pub enum Field {
pub fn name,
fn describe,
}
Name "Name" "Name it";
Colour "Colour" "Choose the colour";
Description "Description" "Describe it";
Title "Title" "Name it";
Due "Due date" "Set the due date";
Owner "Owner" "Choose the owner";
Private "Visibility" "Make it public or private";
Readme "README" "Add a README, or not";
Gitignore ".gitignore" "Choose a .gitignore template";
License "Licence" "Choose a licence";
AllBranches "Branches" "Copy all branches, or the default one";
Path "Path" "Name the file, or move it";
Branch "Commit to" "Choose the branch to commit to";
Message "Message" "Write the commit message";
}
impl Field {
pub fn toggles(self) -> bool {
matches!(self, Field::Private | Field::Readme | Field::AllBranches)
}
}