@pheem49/mint 1.8.1 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +3 -3
- package/Cargo.toml +1 -1
- package/README.md +0 -17
- package/Release_Note.md +137 -58
- package/bin/mint +0 -0
- package/crates/mint-cli/src/agent.rs +150 -45
- package/crates/mint-cli/src/image.rs +8 -8
- package/crates/mint-cli/src/main.rs +929 -412
- package/crates/mint-cli/src/onboard.rs +108 -108
- package/crates/mint-cli/src/setup.rs +143 -143
- package/crates/mint-core/src/agent_loop.rs +1 -0
- package/crates/mint-core/src/api_server.rs +108 -52
- package/crates/mint-core/src/browser.rs +56 -1
- package/crates/mint-core/src/channels.rs +1 -0
- package/crates/mint-core/src/chat.rs +126 -8
- package/crates/mint-core/src/code_tools.rs +18 -20
- package/crates/mint-core/src/config.rs +245 -17
- package/crates/mint-core/src/image_gen.rs +5 -5
- package/crates/mint-core/src/lib.rs +16 -2
- package/crates/mint-core/src/memory.rs +6 -1
- package/crates/mint-core/src/orchestration.rs +260 -72
- package/crates/mint-core/src/pictures.rs +3 -4
- package/crates/mint-core/src/semantic.rs +1 -1
- package/crates/mint-core/src/shell.rs +1 -1
- package/crates/mint-core/src/skills.rs +46 -19
- package/crates/mint-core/src/tts.rs +3 -1
- package/flatpak/com.pheem49.mint.desktop +9 -0
- package/flatpak/com.pheem49.mint.metainfo.xml +35 -0
- package/flatpak/com.pheem49.mint.yaml +52 -0
- package/package.json +1 -1
- package/shared-modules/.github/workflows/ci.yml +120 -0
- package/shared-modules/.github/workflows/update.yaml +28 -0
- package/shared-modules/CODEOWNERS +23 -0
- package/shared-modules/README.md +79 -0
- package/shared-modules/SDL/README.md +3 -0
- package/shared-modules/SDL/SDL-1.2.15.json +51 -0
- package/shared-modules/SDL/SDL_Pango-0.1.2-API-adds.patch +118 -0
- package/shared-modules/SDL/SDL_image-1.2.12.json +25 -0
- package/shared-modules/SDL/SDL_mixer-1.2.12.json +27 -0
- package/shared-modules/SDL/SDL_net-1.2.8.json +19 -0
- package/shared-modules/SDL/SDL_pango-0.1.2.json +26 -0
- package/shared-modules/SDL/SDL_ttf-2.0.11.json +28 -0
- package/shared-modules/SDL/libsdl-1.2.15-strict-prototypes.patch +316 -0
- package/shared-modules/SDL/sdl-check-for-SDL_VIDEO_X11_BACKINGSTORE.patch +24 -0
- package/shared-modules/SDL/sdl-libx11-build.patch +59 -0
- package/shared-modules/SDL/sdl-sysloadso-buffer-length.patch +27 -0
- package/shared-modules/SDL/sdl12-compat.json +22 -0
- package/shared-modules/SDL2/SDL2_image.json +27 -0
- package/shared-modules/SDL2/SDL2_ttf.json +29 -0
- package/shared-modules/cld2/CMakeLists.txt +157 -0
- package/shared-modules/cld2/cld2.json +24 -0
- package/shared-modules/clutter/clutter.json +72 -0
- package/shared-modules/dbus-glib/dbus-glib.json +29 -0
- package/shared-modules/glew/glew.json +36 -0
- package/shared-modules/glu/glu-9.json +12 -0
- package/shared-modules/gtk2/arc-gtk2-theme-Replace-Inkscape-dependency-with-rsvg-convert.patch +180 -0
- package/shared-modules/gtk2/gtk2-common-themes.json +360 -0
- package/shared-modules/gtk2/gtk2-fix-crash-in-show-uri.patch +30 -0
- package/shared-modules/gtk2/gtk2-gcc14.patch +281 -0
- package/shared-modules/gtk2/gtk2-gcc15.patch +250 -0
- package/shared-modules/gtk2/gtk2-murrine-c99.patch +34 -0
- package/shared-modules/gtk2/gtk2-use-adwaita-theme.patch +80 -0
- package/shared-modules/gtk2/gtk2.json +120 -0
- package/shared-modules/gtk2/ibus-gcc15.patch +13 -0
- package/shared-modules/gtk2/murrine-engine-fix-crash.patch +12 -0
- package/shared-modules/gtk2/readme.md +10 -0
- package/shared-modules/intltool/intltool-0.51.json +20 -0
- package/shared-modules/intltool/intltool-perl5.26-regex-fixes.patch +59 -0
- package/shared-modules/lame/0001-Build-xmm_quantize_sub.c-with-msse.patch +34 -0
- package/shared-modules/lame/0002-Include-GTK-1-autoconf-directives-in-build-system.patch +222 -0
- package/shared-modules/lame/0003-Patch-out-remaining-ansi2knr.patch +70 -0
- package/shared-modules/lame/0004-initscr-is-not-used-anywhere-in-lame-sourcetree.patch +41 -0
- package/shared-modules/lame/0005-Update-autoconf.patch +81 -0
- package/shared-modules/lame/lame-3.99.5.json +32 -0
- package/shared-modules/libappindicator/libappindicator-gtk2-12.10.json +140 -0
- package/shared-modules/libappindicator/libappindicator-gtk3-12.10.json +140 -0
- package/shared-modules/libappindicator/libappindicator-gtk3-introspection-12.10.json +140 -0
- package/shared-modules/libappindicator/patches/0001-libappindicator-ftbfs.patch +20 -0
- package/shared-modules/libappindicator/patches/0002-libappindicator-no-python.patch +888 -0
- package/shared-modules/libappindicator/patches/0003-libappindicator-fix-crash-from-incorrect-signal-emission.patch +74 -0
- package/shared-modules/libappindicator/patches/0004-libappindicator-fix-crash-iterating-icon-themes.patch +11 -0
- package/shared-modules/libayatana-appindicator/0001-Fix-HAVE_VALGRIND-AM_CONDITIONAL.patch +51 -0
- package/shared-modules/libayatana-appindicator/0001-Make-introspection-configurable.patch +44 -0
- package/shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json +121 -0
- package/shared-modules/libcanberra/0001-gtk-Don-t-assume-all-GdkDisplays-are-GdkX11Displays-.patch +123 -0
- package/shared-modules/libcanberra/libcanberra.json +44 -0
- package/shared-modules/libmad/libmad.json +19 -0
- package/shared-modules/libsecret/libsecret.json +23 -0
- package/shared-modules/libsoup/libsoup-2.4.json +14 -0
- package/shared-modules/libusb/libusb.json +27 -0
- package/shared-modules/linux-audio/dssi.json +31 -0
- package/shared-modules/linux-audio/fftw3f-static.json +44 -0
- package/shared-modules/linux-audio/fftw3f.json +42 -0
- package/shared-modules/linux-audio/fluidsynth2-static.json +36 -0
- package/shared-modules/linux-audio/fluidsynth2.json +25 -0
- package/shared-modules/linux-audio/ladspa.json +26 -0
- package/shared-modules/linux-audio/lash.json +35 -0
- package/shared-modules/linux-audio/libinstpatch.json +16 -0
- package/shared-modules/linux-audio/liblo-static.json +22 -0
- package/shared-modules/linux-audio/liblo.json +17 -0
- package/shared-modules/linux-audio/lilv-static.json +94 -0
- package/shared-modules/linux-audio/lilv.json +89 -0
- package/shared-modules/linux-audio/lrdf.json +57 -0
- package/shared-modules/linux-audio/lv2.json +20 -0
- package/shared-modules/linux-audio/patches/lash/0001-configure-remove-aclocal-m4.patch +29 -0
- package/shared-modules/linux-audio/patches/lash/0002-Fix-build-with-recent-gcc.patch +73 -0
- package/shared-modules/linux-audio/patches/lash/0003-Fix-linking.patch +136 -0
- package/shared-modules/linux-audio/patches/raptor-libxml.patch +31 -0
- package/shared-modules/linux-audio/patches/stk-install.sh +54 -0
- package/shared-modules/linux-audio/stk.json +28 -0
- package/shared-modules/lua5.1/0004-Fix-stack-overflow-in-vararg-functions.patch +21 -0
- package/shared-modules/lua5.1/lua-5.1.5-so.patch +43 -0
- package/shared-modules/lua5.1/lua-5.1.5.json +42 -0
- package/shared-modules/lua5.3/lua-5.3.5.json +41 -0
- package/shared-modules/lua5.3/lua.pc.in +8 -0
- package/shared-modules/lua5.3/luaconf.patch +47 -0
- package/shared-modules/lua5.3/makefile-add-liblua.so-rule.patch +47 -0
- package/shared-modules/lua5.4/lua-5.4.json +41 -0
- package/shared-modules/lua5.4/lua.pc.in +8 -0
- package/shared-modules/lua5.4/luaconf.patch +34 -0
- package/shared-modules/lua5.4/makefile-add-liblua.so-rule.patch +42 -0
- package/shared-modules/luajit/luajit.json +30 -0
- package/shared-modules/lzo/lzo.json +27 -0
- package/shared-modules/mac/mac.json +18 -0
- package/shared-modules/physfs/physfs.json +26 -0
- package/shared-modules/pygame/audiofile-gcc6.patch +21 -0
- package/shared-modules/pygame/cython-fixes.patch +34 -0
- package/shared-modules/pygame/fluidsynth-no-rawmidi.patch +69 -0
- package/shared-modules/pygame/glib.patch +25 -0
- package/shared-modules/pygame/pygame1-python2.json +157 -0
- package/shared-modules/pygtk/pygtk-c99.patch +15 -0
- package/shared-modules/pygtk/pygtk.json +117 -0
- package/shared-modules/pygtk/pygtk.patch +39 -0
- package/shared-modules/python2.7/python-2.7.json +48 -0
- package/shared-modules/smpeg/smpeg-0.4.5.json +50 -0
- package/shared-modules/smpeg/smpeg-am-prog-as.patch +12 -0
- package/shared-modules/smpeg/smpeg-export-mpegaudio-class.patch +17 -0
- package/shared-modules/smpeg/smpeg-gcc6.patch +40 -0
- package/shared-modules/smpeg/smpeg-no-gtk.patch +37 -0
- package/shared-modules/squashfs-tools/squashfs-tools.json +25 -0
- package/shared-modules/update-checker.sh +50 -0
- package/shared-modules/vorbisgain/0001-temp_files.patch +75 -0
- package/shared-modules/vorbisgain/0002-errno.patch +33 -0
- package/shared-modules/vorbisgain/0003-manpage.patch +248 -0
- package/shared-modules/vorbisgain/0004-vorbisgain_mtime.patch +183 -0
- package/shared-modules/vorbisgain/0005-double_fclose.patch +21 -0
- package/shared-modules/vorbisgain/0006-manpage_hyphens.patch +56 -0
- package/shared-modules/vorbisgain/0007-recursively_spelling.patch +14 -0
- package/shared-modules/vorbisgain/0008-manpage_recursion_mistake.patch +23 -0
- package/shared-modules/vorbisgain/0009-hardening.patch +13 -0
- package/shared-modules/vorbisgain/0010-fclose.patch +13 -0
- package/shared-modules/vorbisgain/README.md +23 -0
- package/shared-modules/vorbisgain/vorbisgain_0.37-2.json +29 -0
- package/src/renderer/shared/agentProgress.ts +145 -0
- package/src/renderer/shared/calculator.ts +52 -0
- package/src/renderer/shared/components/AgentActivityDrawer.tsx +72 -0
- package/src/renderer/shared/components/AgentActivityTable.tsx +85 -0
- package/src/renderer/shared/components/ApprovalCard.tsx +93 -0
- package/src/renderer/shared/components/ChatCodeBlock.tsx +75 -0
- package/src/renderer/shared/components/ThinkingBlock.tsx +101 -0
- package/src/renderer/shared/constants/models.ts +91 -0
- package/src/renderer/shared/platform.ts +82 -0
- package/src/renderer/shared/types.ts +140 -0
- package/src/renderer/shared/utils/agentActivity.ts +187 -0
- package/src/renderer/shared/utils/approval.ts +1 -0
- package/src/renderer/shared/utils/approval.tsx +64 -0
- package/src/renderer/shared/utils/fileIcons.ts +135 -0
- package/src/renderer/shared/utils/markdown.tsx +347 -0
- package/src/renderer/shared/utils/providers.ts +36 -0
- package/src/renderer/shared/utils/speech.ts +216 -0
- package/src/renderer/shared/utils/ui.ts +147 -0
- package/src/renderer/src/agentProgress.ts +11 -39
- package/src/renderer/src/calculator.ts +3 -46
- package/src/renderer/src/components/ChatPanel.tsx +219 -1308
- package/src/renderer/src/components/MintDashboard.tsx +67 -170
- package/src/renderer/src/components/PicturesLibrary.tsx +32 -8
- package/src/renderer/src/components/Settings/AgentsTab.tsx +381 -0
- package/src/renderer/src/components/Settings/AutomationTab.tsx +0 -22
- package/src/renderer/src/components/Settings/GeneralTab.tsx +256 -2
- package/src/renderer/src/components/SettingsWindow.tsx +120 -3
- package/src/renderer/src/components/WorkspacePanel.tsx +7 -125
- package/src/renderer/src/css/styles.css +100 -0
- package/src/renderer/src/tauri.ts +128 -143
- package/src/renderer/src-web/agentProgress.ts +11 -39
- package/src/renderer/src-web/calculator.ts +3 -46
- package/src/renderer/src-web/components/ChatPanel.tsx +219 -1306
- package/src/renderer/src-web/components/MintDashboard.tsx +42 -170
- package/src/renderer/src-web/components/PicturesLibrary.tsx +23 -29
- package/src/renderer/src-web/components/Settings/AgentsTab.tsx +381 -0
- package/src/renderer/src-web/components/Settings/AutomationTab.tsx +0 -22
- package/src/renderer/src-web/components/Settings/GeneralTab.tsx +254 -3
- package/src/renderer/src-web/components/SettingsWindow.tsx +127 -3
- package/src/renderer/src-web/css/styles.css +100 -0
- package/src/renderer/src-web/tauri.ts +180 -102
- package/src-tauri/src/desktop.rs +18 -16
- package/src-tauri/src/discord_rpc.rs +1 -1
- package/src-tauri/src/lib.rs +168 -40
- package/src-tauri/src/webhooks.rs +1 -0
- package/src-tauri/src/workflows.rs +1 -0
- package/src-tauri/tauri.conf.json +1 -1
|
@@ -296,71 +296,71 @@ pub async fn run() -> Result<()> {
|
|
|
296
296
|
loop {
|
|
297
297
|
match event::poll(std::time::Duration::from_millis(100)) {
|
|
298
298
|
Ok(true) => {
|
|
299
|
-
if let Event::Key(key_event) = event::read()?
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
299
|
+
if let Event::Key(key_event) = event::read()?
|
|
300
|
+
&& key_event.kind == event::KeyEventKind::Press
|
|
301
|
+
{
|
|
302
|
+
let is_ctrl_c = matches!(key_event.code, KeyCode::Char('c'))
|
|
303
|
+
&& key_event
|
|
304
|
+
.modifiers
|
|
305
|
+
.contains(crossterm::event::KeyModifiers::CONTROL);
|
|
306
|
+
if is_ctrl_c {
|
|
307
|
+
disable_raw_mode()?;
|
|
308
|
+
println!("\n\x1b[31mOnboarding cancelled.\x1b[0m");
|
|
309
|
+
return Ok(());
|
|
310
|
+
}
|
|
310
311
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
disable_raw_mode()?;
|
|
319
|
-
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
320
|
-
print_services(&services, cursor);
|
|
321
|
-
enable_raw_mode()?;
|
|
312
|
+
match key_event.code {
|
|
313
|
+
KeyCode::Up => {
|
|
314
|
+
if cursor > 0 {
|
|
315
|
+
cursor -= 1;
|
|
316
|
+
} else {
|
|
317
|
+
cursor = services.len() - 1;
|
|
322
318
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
KeyCode::Char(' ') => {
|
|
335
|
-
services[cursor].enabled = !services[cursor].enabled;
|
|
336
|
-
disable_raw_mode()?;
|
|
337
|
-
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
338
|
-
print_services(&services, cursor);
|
|
339
|
-
enable_raw_mode()?;
|
|
340
|
-
}
|
|
341
|
-
KeyCode::Char('a') => {
|
|
342
|
-
for svc in &mut services {
|
|
343
|
-
svc.enabled = true;
|
|
344
|
-
}
|
|
345
|
-
disable_raw_mode()?;
|
|
346
|
-
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
347
|
-
print_services(&services, cursor);
|
|
348
|
-
enable_raw_mode()?;
|
|
319
|
+
disable_raw_mode()?;
|
|
320
|
+
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
321
|
+
print_services(&services, cursor);
|
|
322
|
+
enable_raw_mode()?;
|
|
323
|
+
}
|
|
324
|
+
KeyCode::Down => {
|
|
325
|
+
if cursor < services.len() - 1 {
|
|
326
|
+
cursor += 1;
|
|
327
|
+
} else {
|
|
328
|
+
cursor = 0;
|
|
349
329
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
330
|
+
disable_raw_mode()?;
|
|
331
|
+
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
332
|
+
print_services(&services, cursor);
|
|
333
|
+
enable_raw_mode()?;
|
|
334
|
+
}
|
|
335
|
+
KeyCode::Char(' ') => {
|
|
336
|
+
services[cursor].enabled = !services[cursor].enabled;
|
|
337
|
+
disable_raw_mode()?;
|
|
338
|
+
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
339
|
+
print_services(&services, cursor);
|
|
340
|
+
enable_raw_mode()?;
|
|
341
|
+
}
|
|
342
|
+
KeyCode::Char('a') => {
|
|
343
|
+
for svc in &mut services {
|
|
344
|
+
svc.enabled = true;
|
|
358
345
|
}
|
|
359
|
-
|
|
360
|
-
|
|
346
|
+
disable_raw_mode()?;
|
|
347
|
+
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
348
|
+
print_services(&services, cursor);
|
|
349
|
+
enable_raw_mode()?;
|
|
350
|
+
}
|
|
351
|
+
KeyCode::Char('i') => {
|
|
352
|
+
for svc in &mut services {
|
|
353
|
+
svc.enabled = !svc.enabled;
|
|
361
354
|
}
|
|
362
|
-
|
|
355
|
+
disable_raw_mode()?;
|
|
356
|
+
print!("\x1b[{}A\x1b[J", service_display_lines(&services));
|
|
357
|
+
print_services(&services, cursor);
|
|
358
|
+
enable_raw_mode()?;
|
|
363
359
|
}
|
|
360
|
+
KeyCode::Enter => {
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
_ => {}
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
}
|
|
@@ -1052,52 +1052,52 @@ fn prompt_select_or_custom(
|
|
|
1052
1052
|
loop {
|
|
1053
1053
|
match event::poll(std::time::Duration::from_millis(100)) {
|
|
1054
1054
|
Ok(true) => {
|
|
1055
|
-
if let Event::Key(key_event) = event::read()?
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1055
|
+
if let Event::Key(key_event) = event::read()?
|
|
1056
|
+
&& key_event.kind == event::KeyEventKind::Press
|
|
1057
|
+
{
|
|
1058
|
+
let is_ctrl_c = matches!(key_event.code, KeyCode::Char('c'))
|
|
1059
|
+
&& key_event
|
|
1060
|
+
.modifiers
|
|
1061
|
+
.contains(crossterm::event::KeyModifiers::CONTROL);
|
|
1062
|
+
if is_ctrl_c {
|
|
1063
|
+
disable_raw_mode()?;
|
|
1064
|
+
println!("\n\x1b[31mOnboarding cancelled.\x1b[0m");
|
|
1065
|
+
bail!("onboarding cancelled");
|
|
1066
|
+
}
|
|
1066
1067
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
}
|
|
1074
|
-
disable_raw_mode()?;
|
|
1075
|
-
print!("\x1b[{}A\x1b[J", options.len());
|
|
1076
|
-
print_select_options(&options, cursor);
|
|
1077
|
-
enable_raw_mode()?;
|
|
1068
|
+
match key_event.code {
|
|
1069
|
+
KeyCode::Up => {
|
|
1070
|
+
if cursor > 0 {
|
|
1071
|
+
cursor -= 1;
|
|
1072
|
+
} else {
|
|
1073
|
+
cursor = options.len() - 1;
|
|
1078
1074
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1075
|
+
disable_raw_mode()?;
|
|
1076
|
+
print!("\x1b[{}A\x1b[J", options.len());
|
|
1077
|
+
print_select_options(&options, cursor);
|
|
1078
|
+
enable_raw_mode()?;
|
|
1079
|
+
}
|
|
1080
|
+
KeyCode::Down => {
|
|
1081
|
+
if cursor < options.len() - 1 {
|
|
1082
|
+
cursor += 1;
|
|
1083
|
+
} else {
|
|
1084
|
+
cursor = 0;
|
|
1089
1085
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1086
|
+
disable_raw_mode()?;
|
|
1087
|
+
print!("\x1b[{}A\x1b[J", options.len());
|
|
1088
|
+
print_select_options(&options, cursor);
|
|
1089
|
+
enable_raw_mode()?;
|
|
1090
|
+
}
|
|
1091
|
+
KeyCode::Enter => {
|
|
1092
|
+
disable_raw_mode()?;
|
|
1093
|
+
println!();
|
|
1094
|
+
let selected = options[cursor].clone();
|
|
1095
|
+
if selected == custom_label {
|
|
1096
|
+
return prompt_input(label, Some(current));
|
|
1098
1097
|
}
|
|
1099
|
-
|
|
1098
|
+
return Ok(selected);
|
|
1100
1099
|
}
|
|
1100
|
+
_ => {}
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
@@ -1223,10 +1223,10 @@ fn print_select_options(options: &[String], cursor: usize) {
|
|
|
1223
1223
|
|
|
1224
1224
|
fn prompt_input(label: &str, default: Option<&str>) -> Result<String> {
|
|
1225
1225
|
print!("{}", label);
|
|
1226
|
-
if let Some(d) = default
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
}
|
|
1226
|
+
if let Some(d) = default
|
|
1227
|
+
&& !d.is_empty()
|
|
1228
|
+
{
|
|
1229
|
+
print!(" [\x1b[90m{}\x1b[0m]", d);
|
|
1230
1230
|
}
|
|
1231
1231
|
print!(": ");
|
|
1232
1232
|
io::stdout().flush()?;
|
|
@@ -1234,10 +1234,10 @@ fn prompt_input(label: &str, default: Option<&str>) -> Result<String> {
|
|
|
1234
1234
|
let mut input = String::new();
|
|
1235
1235
|
io::stdin().read_line(&mut input)?;
|
|
1236
1236
|
let trimmed = input.trim();
|
|
1237
|
-
if trimmed.is_empty()
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1237
|
+
if trimmed.is_empty()
|
|
1238
|
+
&& let Some(d) = default
|
|
1239
|
+
{
|
|
1240
|
+
return Ok(d.to_string());
|
|
1241
1241
|
}
|
|
1242
1242
|
Ok(trimmed.to_string())
|
|
1243
1243
|
}
|
|
@@ -175,66 +175,66 @@ pub async fn run() -> Result<Option<String>> {
|
|
|
175
175
|
loop {
|
|
176
176
|
match event::poll(std::time::Duration::from_millis(100)) {
|
|
177
177
|
Ok(true) => {
|
|
178
|
-
if let Event::Key(key_event) = event::read()?
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
178
|
+
if let Event::Key(key_event) = event::read()?
|
|
179
|
+
&& key_event.kind == event::KeyEventKind::Press
|
|
180
|
+
{
|
|
181
|
+
let is_ctrl_c = matches!(key_event.code, KeyCode::Char('c'))
|
|
182
|
+
&& key_event
|
|
183
|
+
.modifiers
|
|
184
|
+
.contains(crossterm::event::KeyModifiers::CONTROL);
|
|
185
|
+
if is_ctrl_c {
|
|
186
|
+
disable_raw_mode()?;
|
|
187
|
+
println!("\n\x1b[31mSetup cancelled.\x1b[0m");
|
|
188
|
+
return Ok(None);
|
|
189
|
+
}
|
|
189
190
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
disable_raw_mode()?;
|
|
198
|
-
redraw_phase_1(&options, cursor);
|
|
199
|
-
enable_raw_mode()?;
|
|
200
|
-
}
|
|
201
|
-
KeyCode::Down => {
|
|
202
|
-
if cursor < options.len() - 1 {
|
|
203
|
-
cursor += 1;
|
|
204
|
-
} else {
|
|
205
|
-
cursor = 0;
|
|
206
|
-
}
|
|
207
|
-
disable_raw_mode()?;
|
|
208
|
-
redraw_phase_1(&options, cursor);
|
|
209
|
-
enable_raw_mode()?;
|
|
210
|
-
}
|
|
211
|
-
KeyCode::Char(' ') => {
|
|
212
|
-
options[cursor].enabled = !options[cursor].enabled;
|
|
213
|
-
disable_raw_mode()?;
|
|
214
|
-
redraw_phase_1(&options, cursor);
|
|
215
|
-
enable_raw_mode()?;
|
|
191
|
+
match key_event.code {
|
|
192
|
+
KeyCode::Up => {
|
|
193
|
+
if cursor > 0 {
|
|
194
|
+
cursor -= 1;
|
|
195
|
+
} else {
|
|
196
|
+
cursor = options.len() - 1;
|
|
216
197
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
198
|
+
disable_raw_mode()?;
|
|
199
|
+
redraw_phase_1(&options, cursor);
|
|
200
|
+
enable_raw_mode()?;
|
|
201
|
+
}
|
|
202
|
+
KeyCode::Down => {
|
|
203
|
+
if cursor < options.len() - 1 {
|
|
204
|
+
cursor += 1;
|
|
205
|
+
} else {
|
|
206
|
+
cursor = 0;
|
|
224
207
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
208
|
+
disable_raw_mode()?;
|
|
209
|
+
redraw_phase_1(&options, cursor);
|
|
210
|
+
enable_raw_mode()?;
|
|
211
|
+
}
|
|
212
|
+
KeyCode::Char(' ') => {
|
|
213
|
+
options[cursor].enabled = !options[cursor].enabled;
|
|
214
|
+
disable_raw_mode()?;
|
|
215
|
+
redraw_phase_1(&options, cursor);
|
|
216
|
+
enable_raw_mode()?;
|
|
217
|
+
}
|
|
218
|
+
KeyCode::Char('a') => {
|
|
219
|
+
for opt in &mut options {
|
|
220
|
+
opt.enabled = true;
|
|
232
221
|
}
|
|
233
|
-
|
|
234
|
-
|
|
222
|
+
disable_raw_mode()?;
|
|
223
|
+
redraw_phase_1(&options, cursor);
|
|
224
|
+
enable_raw_mode()?;
|
|
225
|
+
}
|
|
226
|
+
KeyCode::Char('i') => {
|
|
227
|
+
for opt in &mut options {
|
|
228
|
+
opt.enabled = !opt.enabled;
|
|
235
229
|
}
|
|
236
|
-
|
|
230
|
+
disable_raw_mode()?;
|
|
231
|
+
redraw_phase_1(&options, cursor);
|
|
232
|
+
enable_raw_mode()?;
|
|
233
|
+
}
|
|
234
|
+
KeyCode::Enter => {
|
|
235
|
+
break;
|
|
237
236
|
}
|
|
237
|
+
_ => {}
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
}
|
|
@@ -298,67 +298,67 @@ pub async fn run() -> Result<Option<String>> {
|
|
|
298
298
|
loop {
|
|
299
299
|
match event::poll(std::time::Duration::from_millis(100)) {
|
|
300
300
|
Ok(true) => {
|
|
301
|
-
if let Event::Key(key_event) = event::read()?
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
301
|
+
if let Event::Key(key_event) = event::read()?
|
|
302
|
+
&& key_event.kind == event::KeyEventKind::Press
|
|
303
|
+
{
|
|
304
|
+
let is_ctrl_c = matches!(key_event.code, KeyCode::Char('c'))
|
|
305
|
+
&& key_event
|
|
306
|
+
.modifiers
|
|
307
|
+
.contains(crossterm::event::KeyModifiers::CONTROL);
|
|
308
|
+
if is_ctrl_c {
|
|
309
|
+
disable_raw_mode()?;
|
|
310
|
+
println!("\n\x1b[31mSetup cancelled.\x1b[0m");
|
|
311
|
+
return Ok(None);
|
|
312
|
+
}
|
|
312
313
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
disable_raw_mode()?;
|
|
321
|
-
redraw_phase_2(&native_options, native_cursor);
|
|
322
|
-
enable_raw_mode()?;
|
|
323
|
-
}
|
|
324
|
-
KeyCode::Down => {
|
|
325
|
-
if native_cursor < native_options.len() - 1 {
|
|
326
|
-
native_cursor += 1;
|
|
327
|
-
} else {
|
|
328
|
-
native_cursor = 0;
|
|
329
|
-
}
|
|
330
|
-
disable_raw_mode()?;
|
|
331
|
-
redraw_phase_2(&native_options, native_cursor);
|
|
332
|
-
enable_raw_mode()?;
|
|
314
|
+
match key_event.code {
|
|
315
|
+
KeyCode::Up => {
|
|
316
|
+
if native_cursor > 0 {
|
|
317
|
+
native_cursor -= 1;
|
|
318
|
+
} else {
|
|
319
|
+
native_cursor = native_options.len() - 1;
|
|
333
320
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
opt.enabled = true;
|
|
344
|
-
}
|
|
345
|
-
disable_raw_mode()?;
|
|
346
|
-
redraw_phase_2(&native_options, native_cursor);
|
|
347
|
-
enable_raw_mode()?;
|
|
321
|
+
disable_raw_mode()?;
|
|
322
|
+
redraw_phase_2(&native_options, native_cursor);
|
|
323
|
+
enable_raw_mode()?;
|
|
324
|
+
}
|
|
325
|
+
KeyCode::Down => {
|
|
326
|
+
if native_cursor < native_options.len() - 1 {
|
|
327
|
+
native_cursor += 1;
|
|
328
|
+
} else {
|
|
329
|
+
native_cursor = 0;
|
|
348
330
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
331
|
+
disable_raw_mode()?;
|
|
332
|
+
redraw_phase_2(&native_options, native_cursor);
|
|
333
|
+
enable_raw_mode()?;
|
|
334
|
+
}
|
|
335
|
+
KeyCode::Char(' ') => {
|
|
336
|
+
native_options[native_cursor].enabled =
|
|
337
|
+
!native_options[native_cursor].enabled;
|
|
338
|
+
disable_raw_mode()?;
|
|
339
|
+
redraw_phase_2(&native_options, native_cursor);
|
|
340
|
+
enable_raw_mode()?;
|
|
341
|
+
}
|
|
342
|
+
KeyCode::Char('a') => {
|
|
343
|
+
for opt in &mut native_options {
|
|
344
|
+
opt.enabled = true;
|
|
356
345
|
}
|
|
357
|
-
|
|
358
|
-
|
|
346
|
+
disable_raw_mode()?;
|
|
347
|
+
redraw_phase_2(&native_options, native_cursor);
|
|
348
|
+
enable_raw_mode()?;
|
|
349
|
+
}
|
|
350
|
+
KeyCode::Char('i') => {
|
|
351
|
+
for opt in &mut native_options {
|
|
352
|
+
opt.enabled = !opt.enabled;
|
|
359
353
|
}
|
|
360
|
-
|
|
354
|
+
disable_raw_mode()?;
|
|
355
|
+
redraw_phase_2(&native_options, native_cursor);
|
|
356
|
+
enable_raw_mode()?;
|
|
361
357
|
}
|
|
358
|
+
KeyCode::Enter => {
|
|
359
|
+
break;
|
|
360
|
+
}
|
|
361
|
+
_ => {}
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
}
|
|
@@ -410,44 +410,44 @@ pub async fn run() -> Result<Option<String>> {
|
|
|
410
410
|
loop {
|
|
411
411
|
match event::poll(std::time::Duration::from_millis(100)) {
|
|
412
412
|
Ok(true) => {
|
|
413
|
-
if let Event::Key(key_event) = event::read()?
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
413
|
+
if let Event::Key(key_event) = event::read()?
|
|
414
|
+
&& key_event.kind == event::KeyEventKind::Press
|
|
415
|
+
{
|
|
416
|
+
let is_ctrl_c = matches!(key_event.code, KeyCode::Char('c'))
|
|
417
|
+
&& key_event
|
|
418
|
+
.modifiers
|
|
419
|
+
.contains(crossterm::event::KeyModifiers::CONTROL);
|
|
420
|
+
if is_ctrl_c {
|
|
421
|
+
disable_raw_mode()?;
|
|
422
|
+
println!("\n\x1b[31mRun selection cancelled.\x1b[0m");
|
|
423
|
+
return Ok(None);
|
|
424
|
+
}
|
|
424
425
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
}
|
|
432
|
-
disable_raw_mode()?;
|
|
433
|
-
redraw_phase_3(&run_options, run_cursor);
|
|
434
|
-
enable_raw_mode()?;
|
|
435
|
-
}
|
|
436
|
-
KeyCode::Down => {
|
|
437
|
-
if run_cursor < run_options.len() - 1 {
|
|
438
|
-
run_cursor += 1;
|
|
439
|
-
} else {
|
|
440
|
-
run_cursor = 0;
|
|
441
|
-
}
|
|
442
|
-
disable_raw_mode()?;
|
|
443
|
-
redraw_phase_3(&run_options, run_cursor);
|
|
444
|
-
enable_raw_mode()?;
|
|
426
|
+
match key_event.code {
|
|
427
|
+
KeyCode::Up => {
|
|
428
|
+
if run_cursor > 0 {
|
|
429
|
+
run_cursor -= 1;
|
|
430
|
+
} else {
|
|
431
|
+
run_cursor = run_options.len() - 1;
|
|
445
432
|
}
|
|
446
|
-
|
|
447
|
-
|
|
433
|
+
disable_raw_mode()?;
|
|
434
|
+
redraw_phase_3(&run_options, run_cursor);
|
|
435
|
+
enable_raw_mode()?;
|
|
436
|
+
}
|
|
437
|
+
KeyCode::Down => {
|
|
438
|
+
if run_cursor < run_options.len() - 1 {
|
|
439
|
+
run_cursor += 1;
|
|
440
|
+
} else {
|
|
441
|
+
run_cursor = 0;
|
|
448
442
|
}
|
|
449
|
-
|
|
443
|
+
disable_raw_mode()?;
|
|
444
|
+
redraw_phase_3(&run_options, run_cursor);
|
|
445
|
+
enable_raw_mode()?;
|
|
446
|
+
}
|
|
447
|
+
KeyCode::Enter => {
|
|
448
|
+
break;
|
|
450
449
|
}
|
|
450
|
+
_ => {}
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
}
|