-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API draft for the rewrite #308
base: rewrite
Are you sure you want to change the base?
API draft for the rewrite #308
Conversation
I've been working on this and there are still some implementations and features missing, but as far as the API goes I think it's pretty good. This is currently still missing the entire libvirt implementation as well as the However, the connection check using a TcpStream should already be more stable than the simple check using Netcat, so I think there's a lot of value to be had here once this is more feature-complete. |
} | ||
match sub_matches.get_one::<String>("NAME") { | ||
None => bail!("App is required and should never be None here"), | ||
Some(app) => client.run_executable(app.to_owned()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can probably make this nicer without to_owned
kill_vm(config); | ||
} | ||
match sub_matches.get_one::<String>("NAME") { | ||
None => bail!("App is required and should never be None here"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably panic
See log above for more detail." | ||
.into(), | ||
) | ||
pub macro ensure { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have a docstring
($expr:expr, $($fmt:tt)*) => {{ | ||
$crate::into_error!($expr, format!($($fmt)*)).unwrap_or_else(|e| e.panic()) | ||
}}; | ||
pub macro bail { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs doc
|
||
use crate::{bail, Config, Error, IntoResult, Result}; | ||
|
||
static CONFIG: OnceLock<Config> = OnceLock::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This static can probably be inlined into load
This seems great (just a quick look, no proper review). I didn't checked the repo in a while (as written before I sadly lack time to work on winapps at the moment). Didn't expect this to be that far. |
This PR is a draft for how the API of the rewrite could look like.
There are no implementations yet, but once the API is stable the implementations for features can gradually be put in place.
The main difference between the design of legacy WinApps is that the config is the single source of truth for installed apps and will later also contain paths to the icons for the installed apps, meaning we can get rid of the "pre-configured" apps currently found in the
apps
folder. A sample config would look like this:This also merges and therefore supersedes #195.