Compare commits
No commits in common. "5049820f9fcd1a00d5d6153abb8187c1539bdacd" and "907db9f122d8b41d2649f442099b50eb70e9f87a" have entirely different histories.
5049820f9f
...
907db9f122
5 changed files with 12 additions and 80 deletions
|
@ -1 +0,0 @@
|
|||
//
|
|
@ -1,4 +0,0 @@
|
|||
//
|
||||
use git_next_core::message;
|
||||
|
||||
message!(Start, "Start the TUI");
|
|
@ -1,61 +0,0 @@
|
|||
//
|
||||
mod handlers;
|
||||
pub mod messages;
|
||||
|
||||
use std::io::{stderr, Stderr};
|
||||
|
||||
use actix::{Actor, Context};
|
||||
|
||||
use ratatui::{
|
||||
crossterm::{
|
||||
execute,
|
||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
},
|
||||
prelude::CrosstermBackend,
|
||||
Terminal,
|
||||
};
|
||||
|
||||
pub struct Tui {
|
||||
terminal: Option<Terminal<CrosstermBackend<Stderr>>>,
|
||||
}
|
||||
|
||||
impl Actor for Tui {
|
||||
type Context = Context<Self>;
|
||||
|
||||
fn started(&mut self, _ctx: &mut Self::Context) {
|
||||
match init() {
|
||||
Ok(terminal) => {
|
||||
self.terminal.replace(terminal);
|
||||
}
|
||||
Err(err) => tracing::error!(?err, "Failed to start terminal UI"),
|
||||
}
|
||||
}
|
||||
|
||||
fn stopped(&mut self, _ctx: &mut Self::Context) {
|
||||
if let Err(err) = restore() {
|
||||
match std::env::consts::OS {
|
||||
"linux" | "macos" => {
|
||||
tracing::error!(
|
||||
?err,
|
||||
"Failed to restore terminal: Type `reset` to restore terminal"
|
||||
);
|
||||
}
|
||||
"windows" => {
|
||||
tracing::error!(?err, "Failed to restore terminal: Reopen a new terminal");
|
||||
}
|
||||
_ => tracing::error!(?err, "Failed to restore terminal"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn init() -> std::io::Result<Terminal<CrosstermBackend<Stderr>>> {
|
||||
execute!(stderr(), EnterAlternateScreen)?;
|
||||
enable_raw_mode()?;
|
||||
Terminal::new(CrosstermBackend::new(stderr()))
|
||||
}
|
||||
|
||||
fn restore() -> std::io::Result<()> {
|
||||
execute!(stderr(), LeaveAlternateScreen)?;
|
||||
disable_raw_mode()
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
//
|
||||
mod actor;
|
|
@ -1,23 +1,23 @@
|
|||
[workspace]
|
||||
# Disable git releases for all packages by default
|
||||
git_release_enable = true
|
||||
git_release_enable = false
|
||||
|
||||
# Disable git tags for all packages by default
|
||||
git_tag_enable = true
|
||||
git_tag_enable = false
|
||||
|
||||
# set the path of all the crates to the changelog to the root of the repository
|
||||
changelog_path = "./CHANGELOG.md"
|
||||
|
||||
# [[package]]
|
||||
# name = "git-next"
|
||||
# # (Optional) Customize the git tag name to remove the `my_main_package` prefix.
|
||||
# git_tag_name = "v{{ version }}"
|
||||
#
|
||||
# # Enable git tags for this package
|
||||
# git_tag_enable = true
|
||||
#
|
||||
# # Enable git releases for this package
|
||||
# git_release_enable = true
|
||||
[[package]]
|
||||
name = "git-next"
|
||||
# (Optional) Customize the git tag name to remove the `my_main_package` prefix.
|
||||
git_tag_name = "v{{ version }}"
|
||||
|
||||
# Enable git tags for this package
|
||||
git_tag_enable = true
|
||||
|
||||
# Enable git releases for this package
|
||||
git_release_enable = true
|
||||
|
||||
[changelog]
|
||||
body = """
|
||||
|
|
Loading…
Reference in a new issue