luxe update and /update, editable question answers, and a version bump owed once per release
- luxe update and /update update Luxe with the command for however it was installed (cargo or Homebrew), run one program at a time with the terminal attached, then check that the luxe on PATH is the new version. Luxe never downloads or replaces its own binary. The start screen says "Update available · /update". - A question's typed answer edits at its caret: arrows, word jumps, Home, End and Delete work, and up and down move through a wrapped answer before leaving it. - The version check owes a bump once per release: the version on main is the next release, and only a released one (a v-tag) has to move. - Dependency updates arrive through the sync, so Dependabot and the weekly jobs no longer run here.
This commit is contained in:
@@ -21,6 +21,7 @@ pub(super) fn run_slash(app: &mut App, cmd: &crate::commands::Command) -> bool {
|
||||
}
|
||||
}
|
||||
id::SESSIONS => app.open_sessions(),
|
||||
id::UPDATE => app.outbox.update = true,
|
||||
id::MODEL => {
|
||||
// Opens the searchable model picker (also reachable from the palette). Selecting a
|
||||
// model sends `Action::SetModel`, switching the active model in-session.
|
||||
|
||||
@@ -122,6 +122,8 @@ fn run_command(app: &mut App, command: crate::commands::Command) {
|
||||
// The mode outlives the session, so it is chosen here rather than in a session made for it
|
||||
id::MODE => super::commands::dispatch(app, command),
|
||||
id::SESSIONS => app.open_sessions(),
|
||||
// Leaves Luxe, so a session started for it would only be left empty
|
||||
id::UPDATE => app.outbox.update = true,
|
||||
_ if command.slash_name() == Some("/quit") => {
|
||||
app.should_quit = true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ pub struct Outbox {
|
||||
pub issue: Option<u64>,
|
||||
/// A session of yours to leave this one for, and what the reader carries into it
|
||||
pub resume: Option<crate::main_loop::ResumeLaunch>,
|
||||
/// Whether to leave and update Luxe
|
||||
pub update: bool,
|
||||
/// Text to hand to the reader's editor and bring back
|
||||
pub text_edit: Option<TextEdit>,
|
||||
/// A file or folder to open in the reader's editor
|
||||
@@ -45,7 +47,8 @@ pub struct Outbox {
|
||||
|
||||
impl Outbox {
|
||||
/// The exit the parked asks end the TUI with, taking them all; when several are parked the
|
||||
/// last of an editor file, a worktree removal, an issue, a resume and a pull request fix wins.
|
||||
/// last of an editor file, a worktree removal, an issue, a resume, a pull request fix and an
|
||||
/// update wins.
|
||||
pub fn exit(&mut self) -> Option<TuiExit> {
|
||||
[
|
||||
self.editor_file.take().map(TuiExit::OpenInEditor),
|
||||
@@ -53,6 +56,7 @@ impl Outbox {
|
||||
self.issue.take().map(TuiExit::TakeUpIssue),
|
||||
self.resume.take().map(TuiExit::ResumeSession),
|
||||
self.pull_request_fix.take().map(TuiExit::FixPullRequest),
|
||||
std::mem::take(&mut self.update).then_some(TuiExit::Update),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
@@ -93,6 +97,10 @@ mod tests {
|
||||
..Outbox::default()
|
||||
};
|
||||
assert_eq!(everything.exit(), Some(TuiExit::FixPullRequest(fix)));
|
||||
// An update asked for after a fix is the one taken, and taken once
|
||||
let mut update = Outbox { issue: Some(7), update: true, ..Outbox::default() };
|
||||
assert_eq!(update.exit(), Some(TuiExit::Update));
|
||||
assert_eq!(update.exit(), None);
|
||||
let mut removal_then_issue = Outbox {
|
||||
worktree_removal: Some(PathBuf::from("/work/.luxe/worktrees/x")),
|
||||
issue: Some(7),
|
||||
|
||||
@@ -381,6 +381,34 @@ fn the_mode_command_on_the_start_screen_stays_on_it() {
|
||||
assert!(matches!(actions.as_slice(), [Action::SetMode(mode)] if mode == "plan"), "{actions:?}");
|
||||
}
|
||||
|
||||
/// `/update` on the start screen leaves Luxe for the CLI's update, which needs the terminal, and
|
||||
/// starts no session on the way out.
|
||||
#[test]
|
||||
fn the_update_command_on_the_start_screen_leaves_to_update() {
|
||||
let (tx, mut rx) = mpsc::channel(100);
|
||||
let mut app = App::new(tx, KeyMap::defaults(), Default::default());
|
||||
app.enter_dashboard(crate::dashboard::DashboardState::new(Vec::new()));
|
||||
let update = crate::commands::CommandRegistry::all().parse_slash("/update").expect("it");
|
||||
app.handle_dashboard_outcome(crate::dashboard::DashOutcome::RunCommand(update));
|
||||
let mut exit = crate::main_loop::TuiExit::Quit;
|
||||
crate::main_loop::collect_exit_for_tests(&mut app, &mut exit);
|
||||
assert_eq!(exit, crate::main_loop::TuiExit::Update);
|
||||
assert!(app.should_quit);
|
||||
assert!(rx.try_recv().is_err(), "no session started for it");
|
||||
}
|
||||
|
||||
/// From a session, `/update` typed in the composer leaves the same way.
|
||||
#[test]
|
||||
fn the_update_command_in_a_session_leaves_to_update() {
|
||||
let (tx, _rx) = mpsc::channel(100);
|
||||
let mut app = App::new(tx, KeyMap::defaults(), Default::default());
|
||||
app.editor.insert_text("/update");
|
||||
app.update(Msg::Key(KeyEvent::new(KeyCode::Enter, KeyModifiers::NONE)));
|
||||
let mut exit = crate::main_loop::TuiExit::Quit;
|
||||
crate::main_loop::collect_exit_for_tests(&mut app, &mut exit);
|
||||
assert_eq!(exit, crate::main_loop::TuiExit::Update);
|
||||
}
|
||||
|
||||
/// Setup's answers reach the reader's file one key at a time, and skipping writes a file that
|
||||
/// chooses nothing, so the first run asks once.
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user