Skip to content

Commit 8298fcb

Browse files
authored
Merge pull request #1 from xermicus/small-fixes
v1.0.2 bugfixes
2 parents 62da958 + 8e8110a commit 8298fcb

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
[package]
22
name = "blindspot"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
authors = ["xermicus <[email protected]>"]
55
edition = "2018"
66
repository = "https://github.com/xermicus/blindspot"
77
license = "MIT"
8+
description = "Install and update single binary apps without any hassle"
9+
readme = "README.md"
10+
categories = ["command-line-utilities"]
11+
keywords = ["package", "manager"]
812

913
[[bin]]
1014
name="blindspot"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ I'm generally fine with this installation method, but it creates a problem: Thes
2727
Download a [release](https://github.com/xermicus/blindspot/releases) and run the `init` command that can install itself:
2828
```bash
2929
cd ~/Downloads # assuming you downloaded it there
30-
chmod +x blindspot
31-
./blindspot init
32-
rm ./blindspot
30+
chmod +x blindspot_x86_64
31+
./blindspot_x86_64 init
32+
rm ./blindspot_x86_64
3333
```
3434
This automatically creates the config file and installs `blindspot` into the current users local bin dir.
3535

src/bspm/installer.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::time::Duration;
55

66
use smol::{Task,Timer};
77
use async_std::os::unix::fs::OpenOptionsExt;
8-
use async_std::fs::{File,copy,remove_file,set_permissions,OpenOptions};
8+
use async_std::fs::{File,copy,remove_file,set_permissions,OpenOptions,create_dir};
99
use async_std::prelude::*;
1010
use anyhow::Context;
1111
use isahc::prelude::*;
@@ -165,6 +165,12 @@ impl Installer {
165165
let file_name = self.path.file_name()
166166
.unwrap_or_else(|| panic!("Invalid filename: {}", self.path.display()));
167167
let mut tmp_path = std::env::temp_dir();
168+
tmp_path.push("blindspot");
169+
if !tmp_path.exists() {
170+
create_dir(&tmp_path)
171+
.await
172+
.unwrap_or_else(|_| panic!("Failed to create tmp dir: {}", &tmp_path.display()))
173+
}
168174
tmp_path.push(file_name);
169175
Ok((
170176
OpenOptions::new()

src/bspm/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,11 @@ impl BSPM {
134134
handles.push(std::thread::spawn(move || {
135135
smol::run(async move {
136136
let result = pkg.update().await;
137+
let ctx = context("❌", &pkg.name).await;
137138
if result.is_err() {
138-
context("❌", &pkg.name).await
139-
.notify(&format!("Update failed: {:?}", &result).replace("\n", ".")).await;
139+
ctx.notify(&format!("Update failed: {:?}", &result).replace("\n", ".")).await;
140140
}
141+
ctx.quit().await.expect("UI failure");
141142
result
142143
})
143144
}));

src/bspm/ui.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ impl UI {
8787
let mut messages: Vec<String> = Vec::new();
8888
let mut bars: HashMap<String,Bar> = HashMap::new();
8989
let cls = format!(
90-
"{}{}{}🔦 blindspot package manger{}",
91-
termion::clear::All,
90+
"{}{}🔦 blindspot package manger{}",
9291
cursor::Goto(1, 1),
9392
style::Bold,
9493
style::Reset,
9594
);
95+
self.draw(termion::clear::All.to_string()).await?;
9696

9797
while let Ok((context, msg)) = self.stdout_recv.recv().await {
9898
// Update
@@ -123,6 +123,9 @@ impl UI {
123123
screen += &fmt_bar(i + 1, pbar.0, pbar.1);
124124
}
125125
screen += &format!("{}", cursor::Goto(1, min(t_y, (bars.len() + messages.len() + 2) as u16)));
126+
if offset > 0 {
127+
screen = termion::clear::All.to_string() + &screen;
128+
}
126129
self.draw(screen).await?;
127130
}
128131
Err(anyhow!("UI failed to receive next message"))

src/cmd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum Command {
2727
#[structopt(help = "Set archive type", short, long, possible_values = &bspm::installer::Archived::variants(), case_insensitive = false)]
2828
archive: Option<bspm::installer::Archived>,
2929
},
30-
#[structopt(name = "remove", about = "Remove a package", alias = "delete")]
30+
#[structopt(name = "remove", about = "Remove a package", alias = "uninstall", alias = "delete")]
3131
Remove {
3232
#[structopt(help = "Name of the package")]
3333
name: String,

0 commit comments

Comments
 (0)