1use std::collections::HashSet;
6#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
7pub enum OutputComponent {
17#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
24 pub fn components(&self, interactive_terminal: bool) -> &'static [OutputComponent] {
26 OutputComponent::Auto => if interactive_terminal {
27 OutputComponent::Full.components(interactive_terminal)
29 OutputComponent::Plain.components(interactive_terminal)
31 OutputComponent::Changes => &[OutputComponent::Changes],
32 OutputComponent::Grid => &[OutputComponent::Grid],
33 OutputComponent::Header => &[OutputComponent::Header],
34 OutputComponent::Numbers => &[OutputComponent::Numbers],
35 OutputComponent::Full => &[
36 OutputComponent::Changes,
37 OutputComponent::Grid,
38 OutputComponent::Header,
39 OutputComponent::Numbers,
41 OutputComponent::Plain => &[],
46impl FromStr for OutputComponent {
49 fn from_str(s: &str) -> Result<Self> {
51 "auto" => Ok(OutputComponent::Auto),
52 "changes" => Ok(OutputComponent::Changes),
53 "grid" => Ok(OutputComponent::Grid),
54 "header" => Ok(OutputComponent::Header),
55 "numbers" => Ok(OutputComponent::Numbers),
56 "full" => Ok(OutputComponent::Full),
57 "plain" | _ => Ok(OutputComponent::Plain),
63pub struct OutputComponents(pub HashSet<OutputComponent>);
65impl OutputComponents {
66 pub fn changes(&self) -> bool {
67 self.0.contains(&OutputComponent::Changes)
70 pub fn grid(&self) -> bool {
71 self.0.contains(&OutputComponent::Grid)
74 pub fn header(&self) -> bool {
75 self.0.contains(&OutputComponent::Header)
78 pub fn numbers(&self) -> bool {
79 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