mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2025-03-03 21:37:12 +00:00
chore(deps): migrate to 2024 rust
This commit is contained in:
parent
c12ae4a8ef
commit
e95c89bf26
|
@ -1,7 +1,7 @@
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
version = "25.1.10"
|
version = "25.1.10"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["tui", "core", "xtask"]
|
members = ["tui", "core", "xtask"]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
name = "linutil_core"
|
name = "linutil_core"
|
||||||
description = "The backend of Linutil."
|
description = "The backend of Linutil."
|
||||||
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/core"
|
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/core"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
include = ["src/*.rs", "Cargo.toml", "tabs/**"]
|
include = ["src/*.rs", "Cargo.toml", "tabs/**"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{Command, ListNode, Tab};
|
use crate::{Command, ListNode, Tab};
|
||||||
use ego_tree::{NodeMut, Tree};
|
use ego_tree::{NodeMut, Tree};
|
||||||
use include_dir::{include_dir, Dir};
|
use include_dir::{Dir, include_dir};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::{
|
use std::{
|
||||||
fs::File,
|
fs::File,
|
||||||
|
|
|
@ -8,7 +8,7 @@ use ego_tree::Tree;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
pub use config::{Config, ConfigValues};
|
pub use config::{Config, ConfigValues};
|
||||||
pub use inner::{get_tabs, TabList};
|
pub use inner::{TabList, get_tabs};
|
||||||
|
|
||||||
#[derive(Clone, Hash, Eq, PartialEq)]
|
#[derive(Clone, Hash, Eq, PartialEq)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
|
|
|
@ -3,7 +3,7 @@ name = "linutil_tui"
|
||||||
description = "Chris Titus Tech's Linux Toolbox - Linutil is a distro-agnostic toolbox designed to simplify everyday Linux tasks."
|
description = "Chris Titus Tech's Linux Toolbox - Linutil is a distro-agnostic toolbox designed to simplify everyday Linux tasks."
|
||||||
documentation = "https://christitustech.github.io/linutil"
|
documentation = "https://christitustech.github.io/linutil"
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
edition = "2021"
|
edition = "2024"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/tui"
|
repository = "https://github.com/ChrisTitusTech/linutil/tree/main/tui"
|
||||||
version.workspace = true
|
version.workspace = true
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::{state::ListEntry, theme::Theme};
|
use crate::{state::ListEntry, theme::Theme};
|
||||||
use linutil_core::{ego_tree::NodeId, Tab};
|
use linutil_core::{Tab, ego_tree::NodeId};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
|
crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
|
@ -160,7 +160,7 @@ impl Filter {
|
||||||
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
|
pub fn handle_key(&mut self, event: &KeyEvent) -> SearchAction {
|
||||||
match event.code {
|
match event.code {
|
||||||
KeyCode::Char('c') if event.modifiers.contains(KeyModifiers::CONTROL) => {
|
KeyCode::Char('c') if event.modifiers.contains(KeyModifiers::CONTROL) => {
|
||||||
return self.exit_search()
|
return self.exit_search();
|
||||||
}
|
}
|
||||||
KeyCode::Char(c) => self.insert_char(c),
|
KeyCode::Char(c) => self.insert_char(c),
|
||||||
KeyCode::Backspace => self.remove_previous(),
|
KeyCode::Backspace => self.remove_previous(),
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use crate::{hint::Shortcut, theme::Theme};
|
use crate::{hint::Shortcut, theme::Theme};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Frame,
|
||||||
crossterm::event::{KeyCode, KeyEvent, MouseEvent},
|
crossterm::event::{KeyCode, KeyEvent, MouseEvent},
|
||||||
layout::{Constraint, Layout, Rect},
|
layout::{Constraint, Layout, Rect},
|
||||||
Frame,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait FloatContent {
|
pub trait FloatContent {
|
||||||
|
|
|
@ -10,9 +10,7 @@ use tree_sitter_bash as hl_bash;
|
||||||
use tree_sitter_highlight::{self as hl, HighlightEvent};
|
use tree_sitter_highlight::{self as hl, HighlightEvent};
|
||||||
|
|
||||||
macro_rules! style {
|
macro_rules! style {
|
||||||
($r:literal, $g:literal, $b:literal) => {{
|
($r:literal, $g:literal, $b:literal) => {{ Style::new().fg(Color::Rgb($r, $g, $b)) }};
|
||||||
Style::new().fg(Color::Rgb($r, $g, $b))
|
|
||||||
}};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const SYNTAX_HIGHLIGHT_STYLES: [(&str, Style); 8] = [
|
const SYNTAX_HIGHLIGHT_STYLES: [(&str, Style); 8] = [
|
||||||
|
|
|
@ -15,18 +15,18 @@ mod tips;
|
||||||
use crate::cli::Args;
|
use crate::cli::Args;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
|
Terminal,
|
||||||
backend::CrosstermBackend,
|
backend::CrosstermBackend,
|
||||||
crossterm::{
|
crossterm::{
|
||||||
|
ExecutableCommand,
|
||||||
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyEventKind},
|
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyEventKind},
|
||||||
style::ResetColor,
|
style::ResetColor,
|
||||||
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
|
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
|
||||||
ExecutableCommand,
|
|
||||||
},
|
},
|
||||||
Terminal,
|
|
||||||
};
|
};
|
||||||
use state::AppState;
|
use state::AppState;
|
||||||
use std::{
|
use std::{
|
||||||
io::{stdout, Result, Stdout},
|
io::{Result, Stdout, stdout},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::{float::FloatContent, hint::Shortcut, shortcuts, theme::Theme};
|
use crate::{float::FloatContent, hint::Shortcut, shortcuts, theme::Theme};
|
||||||
use linutil_core::Command;
|
use linutil_core::Command;
|
||||||
use oneshot::{channel, Receiver};
|
use oneshot::{Receiver, channel};
|
||||||
use portable_pty::{
|
use portable_pty::{
|
||||||
ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem,
|
ChildKiller, CommandBuilder, ExitStatus, MasterPty, NativePtySystem, PtySize, PtySystem,
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ use std::{
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
thread::JoinHandle,
|
thread::JoinHandle,
|
||||||
};
|
};
|
||||||
use time::{macros::format_description, OffsetDateTime};
|
use time::{OffsetDateTime, macros::format_description};
|
||||||
use tui_term::widget::PseudoTerminal;
|
use tui_term::widget::PseudoTerminal;
|
||||||
use vt100_ctt::{Parser, Screen};
|
use vt100_ctt::{Parser, Screen};
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ impl RunningCommand {
|
||||||
break; // EOF
|
break; // EOF
|
||||||
}
|
}
|
||||||
let mut mutex = command_buffer.lock(); // Only lock the mutex after the read is
|
let mut mutex = command_buffer.lock(); // Only lock the mutex after the read is
|
||||||
// done, to minimise the time it is opened
|
// done, to minimise the time it is opened
|
||||||
let command_buffer = mutex.as_mut().unwrap();
|
let command_buffer = mutex.as_mut().unwrap();
|
||||||
command_buffer.extend_from_slice(&buf[0..size]);
|
command_buffer.extend_from_slice(&buf[0..size]);
|
||||||
// The mutex is closed here automatically
|
// The mutex is closed here automatically
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Args,
|
||||||
confirmation::{ConfirmPrompt, ConfirmStatus},
|
confirmation::{ConfirmPrompt, ConfirmStatus},
|
||||||
filter::{Filter, SearchAction},
|
filter::{Filter, SearchAction},
|
||||||
float::{Float, FloatContent},
|
float::{Float, FloatContent},
|
||||||
floating_text::FloatingText,
|
floating_text::FloatingText,
|
||||||
hint::{create_shortcut_list, Shortcut},
|
hint::{Shortcut, create_shortcut_list},
|
||||||
root::check_root_status,
|
root::check_root_status,
|
||||||
running_command::RunningCommand,
|
running_command::RunningCommand,
|
||||||
shortcuts,
|
shortcuts,
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
Args,
|
|
||||||
};
|
};
|
||||||
use linutil_core::{ego_tree::NodeId, Command, Config, ConfigValues, ListNode, TabList};
|
use linutil_core::{Command, Config, ConfigValues, ListNode, TabList, ego_tree::NodeId};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind},
|
crossterm::event::{KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind},
|
||||||
layout::Flex,
|
layout::Flex,
|
||||||
|
@ -209,10 +209,9 @@ impl AppState {
|
||||||
hints.push(Shortcut::new("Focus tab list", ["h", "Left"]));
|
hints.push(Shortcut::new("Focus tab list", ["h", "Left"]));
|
||||||
hints.extend(self.get_list_item_shortcut());
|
hints.extend(self.get_list_item_shortcut());
|
||||||
} else if self.selected_item_is_up_dir() {
|
} else if self.selected_item_is_up_dir() {
|
||||||
hints.push(Shortcut::new(
|
hints.push(Shortcut::new("Go to parent directory", [
|
||||||
"Go to parent directory",
|
"l", "Right", "Enter", "h", "Left",
|
||||||
["l", "Right", "Enter", "h", "Left"],
|
]));
|
||||||
));
|
|
||||||
} else {
|
} else {
|
||||||
hints.push(Shortcut::new("Go to parent directory", ["h", "Left"]));
|
hints.push(Shortcut::new("Go to parent directory", ["h", "Left"]));
|
||||||
hints.extend(self.get_list_item_shortcut());
|
hints.extend(self.get_list_item_shortcut());
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::fs;
|
||||||
|
|
||||||
use linutil_core::Command;
|
use linutil_core::Command;
|
||||||
|
|
||||||
use crate::{path, DynError};
|
use crate::{DynError, path};
|
||||||
|
|
||||||
pub const USER_GUIDE: &str = "userguide.md";
|
pub const USER_GUIDE: &str = "userguide.md";
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ pub fn userguide() -> Result<String, DynError> {
|
||||||
|
|
||||||
md.push_str(&format!("- **{}**: {}\n", entry.name, entry.description));
|
md.push_str(&format!("- **{}**: {}\n", entry.name, entry.description));
|
||||||
} /* else {
|
} /* else {
|
||||||
md.push_str(&format!("- **{}**\n", entry.name));
|
md.push_str(&format!("- **{}**\n", entry.name));
|
||||||
} */ // https://github.com/ChrisTitusTech/linutil/pull/753
|
} */ // https://github.com/ChrisTitusTech/linutil/pull/753
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@ type DynError = Box<dyn Error>;
|
||||||
|
|
||||||
pub mod tasks {
|
pub mod tasks {
|
||||||
use crate::{
|
use crate::{
|
||||||
docgen::{userguide, write, USER_GUIDE},
|
|
||||||
DynError,
|
DynError,
|
||||||
|
docgen::{USER_GUIDE, userguide, write},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn docgen() -> Result<(), DynError> {
|
pub fn docgen() -> Result<(), DynError> {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user