Add application menu to install CLI

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-04-20 16:34:01 +02:00
parent 926c75dadf
commit f77239bd96
3 changed files with 8 additions and 3 deletions

View file

@ -5337,7 +5337,6 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) { async fn test_single_file_worktrees_diagnostics(cx: &mut gpui::TestAppContext) {
cx.foreground().forbid_parking(); cx.foreground().forbid_parking();
language::init_test(cx);
let fs = FakeFs::new(cx.background()); let fs = FakeFs::new(cx.background());
fs.insert_tree( fs.insert_tree(

View file

@ -14,6 +14,12 @@ pub fn menus(state: &Arc<AppState>) -> Vec<Menu<'static>> {
action: Box::new(super::About), action: Box::new(super::About),
}, },
MenuItem::Separator, MenuItem::Separator,
MenuItem::Action {
name: "Install CLI",
keystroke: None,
action: Box::new(super::InstallCommandLineInterface),
},
MenuItem::Separator,
MenuItem::Action { MenuItem::Action {
name: "Quit", name: "Quit",
keystroke: Some("cmd-q"), keystroke: Some("cmd-q"),

View file

@ -43,7 +43,7 @@ actions!(
OpenSettings, OpenSettings,
IncreaseBufferFontSize, IncreaseBufferFontSize,
DecreaseBufferFontSize, DecreaseBufferFontSize,
InstallCommandLineTool, InstallCommandLineInterface,
] ]
); );
@ -71,7 +71,7 @@ pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
cx.refresh_windows(); cx.refresh_windows();
}); });
}); });
cx.add_global_action(move |_: &InstallCommandLineTool, cx| { cx.add_global_action(move |_: &InstallCommandLineInterface, cx| {
cx.spawn(|cx| async move { install_cli(&cx).await.context("error creating CLI symlink") }) cx.spawn(|cx| async move { install_cli(&cx).await.context("error creating CLI symlink") })
.detach_and_log_err(cx); .detach_and_log_err(cx);
}); });