-
-
Notifications
You must be signed in to change notification settings - Fork 73
feature: confirm on the first time using quickinstall #2223
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
base: main
Are you sure you want to change the base?
Conversation
Hmm, two thoughts:
so maybe something like [telemetry]
enable = true
url = "https://..." and then we kinda need to think about / decide what happens if the user changes the url. should we respect that? or should we prompt to change it? |
Yeah I think a formal style is better, though I don't think it should be user configured? I was thinking something like our .json manifest file |
I don't think it should be user configured either but I think if it's text (whether that's toml or json), someone will edit it, so we should probably decide what to do in that case. |
Yeah using toml is definitely more readable than just a string |
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Signed-off-by: Jiahao XU <[email protected]>
Co-authored-by: Félix Saparelli <[email protected]> Signed-off-by: Jiahao XU <[email protected]>
8b36bf6
to
87227bb
Compare
Signed-off-by: Jiahao XU <[email protected]>
Hello @passcod been a bit busy recently to finish this off, do you have time to work on this? |
I'll put it on my list for this weekend |
be4da61
to
0a2bacf
Compare
@NobodyXu I think I've got this in a good place |
0a2bacf
to
1bf599e
Compare
let cargo_config = if let Some(config) = cargo_config { | ||
config | ||
} else { | ||
CargoConfig::load_from_path(cargo_root.join("config.toml"))? |
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.
There's a catch here: what if the new config loaded does specify a install
path?
We probably want to load the config before getting cargo_root
let settings_path = args.settings.clone().unwrap_or( | ||
cargo_home | ||
.as_ref() | ||
.unwrap_or(&cargo_root) | ||
.join("binstall.toml"), | ||
); |
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.
let settings_path = args.settings.clone().unwrap_or( | |
cargo_home | |
.as_ref() | |
.unwrap_or(&cargo_root) | |
.join("binstall.toml"), | |
); | |
let settings_path = args.settings.as_deref().map(Cow::Borrowed).unwrap_or_else(|| | |
Cow::Owned(cargo_home | |
.as_ref() | |
.unwrap_or(&cargo_root) | |
.join("binstall.toml") | |
) | |
); |
} else if let Some(p) = &settings.install_path { | ||
debug!(path=?p, "install path from settings"); | ||
(p.into(), true) | ||
} else if cargo_home.is_some() { |
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.
What even if cargo_root is set, we won't use it if cargo_root is set?
.unwrap_or(&cargo_root) | ||
.join("binstall.toml"), | ||
); | ||
let mut settings = crate::settings::load(args.settings.is_some(), &settings_path)?; |
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.
If we ignore the error when args not set, then we might still fail at installation, e.g. the settings is occupied by a directory/special file, or no permissions
pub struct Settings { | ||
#[serde(default = "tru")] | ||
pub confirm: bool, | ||
|
||
#[serde(default)] | ||
pub install_path: Option<PathBuf>, | ||
|
||
#[serde(default = "tru")] | ||
pub track_installs: bool, | ||
|
||
#[serde(default)] | ||
pub continue_on_failure: bool, | ||
|
||
#[serde(default)] | ||
pub targets: Option<Vec<String>>, | ||
|
||
#[serde(default)] | ||
pub strategies: Vec<StrategyWrapped>, | ||
|
||
#[serde(default)] | ||
pub telemetry: Telemetry, | ||
} |
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.
Hmm personally I think putting it in binstalk-manifest makes more sense
Fixed #2213
if the quickinstall stats url has changed, it'd also require confirm