style: format Cub TUI module
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -8,7 +8,10 @@ use termion::raw::IntoRawMode;
|
|||||||
use termion::screen::IntoAlternateScreen;
|
use termion::screen::IntoAlternateScreen;
|
||||||
|
|
||||||
const SHORTCUTS: &[(&str, &str)] = &[
|
const SHORTCUTS: &[(&str, &str)] = &[
|
||||||
("-S <pkg>", "Install a package from the official repo or BUR"),
|
(
|
||||||
|
"-S <pkg>",
|
||||||
|
"Install a package from the official repo or BUR",
|
||||||
|
),
|
||||||
("-Ss <query>", "Search the official repo and cached BUR"),
|
("-Ss <query>", "Search the official repo and cached BUR"),
|
||||||
("-Si <pkg>", "Show AUR package information"),
|
("-Si <pkg>", "Show AUR package information"),
|
||||||
("-Sy", "Refresh BUR cache and verify AUR metadata access"),
|
("-Sy", "Refresh BUR cache and verify AUR metadata access"),
|
||||||
@@ -27,12 +30,24 @@ const COMMANDS: &[(&str, &str)] = &[
|
|||||||
("search <query>", "Search official repo and BUR cache"),
|
("search <query>", "Search official repo and BUR cache"),
|
||||||
("info <pkg>", "Query AUR metadata"),
|
("info <pkg>", "Query AUR metadata"),
|
||||||
("sync", "Refresh BUR cache and AUR sync stamp"),
|
("sync", "Refresh BUR cache and AUR sync stamp"),
|
||||||
("system-upgrade", "Sync first, then update installed packages"),
|
(
|
||||||
|
"system-upgrade",
|
||||||
|
"Sync first, then update installed packages",
|
||||||
|
),
|
||||||
("build <dir>", "Build and install a local recipe tree"),
|
("build <dir>", "Build and install a local recipe tree"),
|
||||||
("get <pkg>", "Copy a BUR recipe into the current directory"),
|
("get <pkg>", "Copy a BUR recipe into the current directory"),
|
||||||
("get-aur <pkg>", "Convert an AUR PKGBUILD into ~/.cub/recipes"),
|
(
|
||||||
("inspect <target>", "Inspect a local RBPKGBUILD or package metadata"),
|
"get-aur <pkg>",
|
||||||
("import-aur <target>", "Convert an AUR PKGBUILD into the current directory"),
|
"Convert an AUR PKGBUILD into ~/.cub/recipes",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"inspect <target>",
|
||||||
|
"Inspect a local RBPKGBUILD or package metadata",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"import-aur <target>",
|
||||||
|
"Convert an AUR PKGBUILD into the current directory",
|
||||||
|
),
|
||||||
("update-all", "Update installed packages"),
|
("update-all", "Update installed packages"),
|
||||||
("remove <pkg>", "Remove an installed package"),
|
("remove <pkg>", "Remove an installed package"),
|
||||||
("query-local", "List installed packages"),
|
("query-local", "List installed packages"),
|
||||||
@@ -56,15 +71,30 @@ pub fn run() -> io::Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(screen, "{}{}{}", clear::All, cursor::Goto(1, 1), cursor::Show)?;
|
write!(
|
||||||
|
screen,
|
||||||
|
"{}{}{}",
|
||||||
|
clear::All,
|
||||||
|
cursor::Goto(1, 1),
|
||||||
|
cursor::Show
|
||||||
|
)?;
|
||||||
screen.flush()
|
screen.flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(screen: &mut impl Write) -> io::Result<()> {
|
fn render(screen: &mut impl Write) -> io::Result<()> {
|
||||||
write!(screen, "{}{}{}", clear::All, cursor::Goto(1, 1), cursor::Hide)?;
|
write!(
|
||||||
|
screen,
|
||||||
|
"{}{}{}",
|
||||||
|
clear::All,
|
||||||
|
cursor::Goto(1, 1),
|
||||||
|
cursor::Hide
|
||||||
|
)?;
|
||||||
writeln!(screen, "cub — Red Bear OS Package Builder")?;
|
writeln!(screen, "cub — Red Bear OS Package Builder")?;
|
||||||
writeln!(screen)?;
|
writeln!(screen)?;
|
||||||
writeln!(screen, "Default TUI mode is active because no subcommand was provided.")?;
|
writeln!(
|
||||||
|
screen,
|
||||||
|
"Default TUI mode is active because no subcommand was provided."
|
||||||
|
)?;
|
||||||
writeln!(screen, "Run `cub --no-tui` to see clap help instead.")?;
|
writeln!(screen, "Run `cub --no-tui` to see clap help instead.")?;
|
||||||
writeln!(screen)?;
|
writeln!(screen)?;
|
||||||
writeln!(screen, "Arch-style shortcuts")?;
|
writeln!(screen, "Arch-style shortcuts")?;
|
||||||
|
|||||||
Reference in New Issue
Block a user