2use std::collections::HashSet;
5#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
6pub enum OutputComponent {
17 pub fn components(&self, interactive_terminal: bool) -> &'static [OutputComponent] {
19 OutputComponent::Auto => if interactive_terminal {
20 OutputComponent::Full.components(interactive_terminal)
22 OutputComponent::Plain.components(interactive_terminal)
24 OutputComponent::Changes => &[OutputComponent::Changes],
25 OutputComponent::Grid => &[OutputComponent::Grid],
26 OutputComponent::Header => &[OutputComponent::Header],
27 OutputComponent::Numbers => &[OutputComponent::Numbers],
28 OutputComponent::Full => &[
29 OutputComponent::Changes,
30 OutputComponent::Grid,
31 OutputComponent::Header,
32 OutputComponent::Numbers,
34 OutputComponent::Plain => &[],
39impl FromStr for OutputComponent {
42 fn from_str(s: &str) -> Result<Self> {
44 "auto" => Ok(OutputComponent::Auto),
45 "changes" => Ok(OutputComponent::Changes),
46 "grid" => Ok(OutputComponent::Grid),
47 "header" => Ok(OutputComponent::Header),
48 "numbers" => Ok(OutputComponent::Numbers),
49 "full" => Ok(OutputComponent::Full),
50 "plain" | _ => Ok(OutputComponent::Plain),
55pub struct OutputComponents(pub HashSet<OutputComponent>);
57impl OutputComponents {
58 pub fn changes(&self) -> bool {
59 self.0.contains(&OutputComponent::Changes)
62 pub fn grid(&self) -> bool {
63 self.0.contains(&OutputComponent::Grid)
66 pub fn header(&self) -> bool {
67 self.0.contains(&OutputComponent::Header)
70 pub fn numbers(&self) -> bool {
71 self.0.contains(&OutputComponent::Numbers)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list