2use std::collections::HashSet;
5#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
6pub enum OutputComponent {
16#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
23 pub fn components(&self, interactive_terminal: bool) -> &'static [OutputComponent] {
25 OutputComponent::Auto => if interactive_terminal {
26 OutputComponent::Full.components(interactive_terminal)
28 OutputComponent::Plain.components(interactive_terminal)
30 OutputComponent::Changes => &[OutputComponent::Changes],
31 OutputComponent::Grid => &[OutputComponent::Grid],
32 OutputComponent::Header => &[OutputComponent::Header],
33 OutputComponent::Numbers => &[OutputComponent::Numbers],
34 OutputComponent::Full => &[
35 OutputComponent::Changes,
36 OutputComponent::Grid,
37 OutputComponent::Header,
38 OutputComponent::Numbers,
40 OutputComponent::Plain => &[],
45impl FromStr for OutputComponent {
48 fn from_str(s: &str) -> Result<Self> {
50 "auto" => Ok(OutputComponent::Auto),
51 "changes" => Ok(OutputComponent::Changes),
52 "grid" => Ok(OutputComponent::Grid),
53 "header" => Ok(OutputComponent::Header),
54 "numbers" => Ok(OutputComponent::Numbers),
55 "full" => Ok(OutputComponent::Full),
56 "plain" | _ => Ok(OutputComponent::Plain),
61pub struct OutputComponents(pub HashSet<OutputComponent>);
63impl OutputComponents {
64 pub fn changes(&self) -> bool {
65 self.0.contains(&OutputComponent::Changes)
68 pub fn grid(&self) -> bool {
69 self.0.contains(&OutputComponent::Grid)
72 pub fn header(&self) -> bool {
73 self.0.contains(&OutputComponent::Header)
76 pub fn numbers(&self) -> bool {
77 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