feat: add si command line interface (#37)
Reviewed-on: #37
This commit was merged in pull request #37.
This commit is contained in:
+9
-24
@@ -3,6 +3,7 @@ use std::sync::Arc;
|
||||
use gpui::*;
|
||||
use gpui_platform::application;
|
||||
use settings::SettingsStore;
|
||||
use signed_app::AppRoot;
|
||||
use ui::theme::{ActiveTheme as _, Theme};
|
||||
|
||||
actions!(signed, [Quit]);
|
||||
@@ -44,43 +45,27 @@ fn main() {
|
||||
.with_assets(AppAssets)
|
||||
.with_http_client(Arc::new(reqwest_client::ReqwestClient::new()))
|
||||
.run(move |cx| {
|
||||
ui::init(cx);
|
||||
|
||||
cx.bind_keys([
|
||||
KeyBinding::new("cmd-q", Quit, None),
|
||||
KeyBinding::new("ctrl-q", Quit, None),
|
||||
]);
|
||||
|
||||
cx.on_action(|_: &Quit, cx| cx.quit());
|
||||
cx.set_app_identity("build.signed.signed", "Signed");
|
||||
cx.set_app_identity(paths::APP_ID, paths::APP_NAME);
|
||||
|
||||
let store = cx.new(|_| SettingsStore::new(paths::settings_file()));
|
||||
SettingsStore::set_global(store.clone(), cx);
|
||||
ui::init(cx);
|
||||
|
||||
let settings = store.read(cx).settings().clone();
|
||||
signed_app::AppRoot::apply_appearance_mode(settings.appearance, cx);
|
||||
|
||||
if let Err(error) = std::fs::create_dir_all(paths::nostr_dir()) {
|
||||
tracing::warn!("failed to create nostr dir: {error}");
|
||||
}
|
||||
|
||||
if let Err(error) = std::fs::create_dir_all(paths::repos_dir()) {
|
||||
tracing::warn!("failed to create repos dir: {error}");
|
||||
}
|
||||
|
||||
if let Err(error) = signed_state::init(
|
||||
paths::nostr_dir(),
|
||||
paths::repos_dir().to_path_buf(),
|
||||
settings.local_repos.scan_paths.clone(),
|
||||
cx,
|
||||
) {
|
||||
if let Err(error) = signed_state::init(cx) {
|
||||
tracing::error!("failed to initialize application state: {error:#}");
|
||||
cx.quit();
|
||||
return;
|
||||
}
|
||||
|
||||
metadata::init(cx);
|
||||
|
||||
let settings = SettingsStore::global(cx);
|
||||
let appearance = settings.read(cx).settings().appearance;
|
||||
AppRoot::apply_appearance_mode(appearance, cx);
|
||||
|
||||
let theme = cx.theme();
|
||||
let bounds = Bounds::centered(None, size(px(1120.0), px(750.0)), cx);
|
||||
|
||||
@@ -113,7 +98,7 @@ fn main() {
|
||||
})
|
||||
.detach();
|
||||
|
||||
signed_app::AppRoot::mount(window, cx)
|
||||
AppRoot::mount(window, cx)
|
||||
}) {
|
||||
tracing::error!("failed to open window: {error}");
|
||||
cx.quit();
|
||||
|
||||
Reference in New Issue
Block a user