Skip to content

Commit

Permalink
Merge pull request #1 from xermicus/small-fixes
Browse files Browse the repository at this point in the history
v1.0.2 bugfixes
  • Loading branch information
xermicus authored Jun 9, 2020
2 parents 62da958 + 8e8110a commit 8298fcb
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[package]
name = "blindspot"
version = "1.0.1"
version = "1.0.2"
authors = ["xermicus <bigcyrill@hotmail.com>"]
edition = "2018"
repository = "https://github.com/xermicus/blindspot"
license = "MIT"
description = "Install and update single binary apps without any hassle"
readme = "README.md"
categories = ["command-line-utilities"]
keywords = ["package", "manager"]

[[bin]]
name="blindspot"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ I'm generally fine with this installation method, but it creates a problem: Thes
Download a [release](https://github.com/xermicus/blindspot/releases) and run the `init` command that can install itself:
```bash
cd ~/Downloads # assuming you downloaded it there
chmod +x blindspot
./blindspot init
rm ./blindspot
chmod +x blindspot_x86_64
./blindspot_x86_64 init
rm ./blindspot_x86_64
```
This automatically creates the config file and installs `blindspot` into the current users local bin dir.

Expand Down
8 changes: 7 additions & 1 deletion src/bspm/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::time::Duration;

use smol::{Task,Timer};
use async_std::os::unix::fs::OpenOptionsExt;
use async_std::fs::{File,copy,remove_file,set_permissions,OpenOptions};
use async_std::fs::{File,copy,remove_file,set_permissions,OpenOptions,create_dir};
use async_std::prelude::*;
use anyhow::Context;
use isahc::prelude::*;
Expand Down Expand Up @@ -165,6 +165,12 @@ impl Installer {
let file_name = self.path.file_name()
.unwrap_or_else(|| panic!("Invalid filename: {}", self.path.display()));
let mut tmp_path = std::env::temp_dir();
tmp_path.push("blindspot");
if !tmp_path.exists() {
create_dir(&tmp_path)
.await
.unwrap_or_else(|_| panic!("Failed to create tmp dir: {}", &tmp_path.display()))
}
tmp_path.push(file_name);
Ok((
OpenOptions::new()
Expand Down
5 changes: 3 additions & 2 deletions src/bspm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ impl BSPM {
handles.push(std::thread::spawn(move || {
smol::run(async move {
let result = pkg.update().await;
let ctx = context("❌", &pkg.name).await;
if result.is_err() {
context("❌", &pkg.name).await
.notify(&format!("Update failed: {:?}", &result).replace("\n", ".")).await;
ctx.notify(&format!("Update failed: {:?}", &result).replace("\n", ".")).await;
}
ctx.quit().await.expect("UI failure");
result
})
}));
Expand Down
7 changes: 5 additions & 2 deletions src/bspm/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ impl UI {
let mut messages: Vec<String> = Vec::new();
let mut bars: HashMap<String,Bar> = HashMap::new();
let cls = format!(
"{}{}{}🔦 blindspot package manger{}",
termion::clear::All,
"{}{}🔦 blindspot package manger{}",
cursor::Goto(1, 1),
style::Bold,
style::Reset,
);
self.draw(termion::clear::All.to_string()).await?;

while let Ok((context, msg)) = self.stdout_recv.recv().await {
// Update
Expand Down Expand Up @@ -123,6 +123,9 @@ impl UI {
screen += &fmt_bar(i + 1, pbar.0, pbar.1);
}
screen += &format!("{}", cursor::Goto(1, min(t_y, (bars.len() + messages.len() + 2) as u16)));
if offset > 0 {
screen = termion::clear::All.to_string() + &screen;
}
self.draw(screen).await?;
}
Err(anyhow!("UI failed to receive next message"))
Expand Down
2 changes: 1 addition & 1 deletion src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub enum Command {
#[structopt(help = "Set archive type", short, long, possible_values = &bspm::installer::Archived::variants(), case_insensitive = false)]
archive: Option<bspm::installer::Archived>,
},
#[structopt(name = "remove", about = "Remove a package", alias = "delete")]
#[structopt(name = "remove", about = "Remove a package", alias = "uninstall", alias = "delete")]
Remove {
#[structopt(help = "Name of the package")]
name: String,
Expand Down

0 comments on commit 8298fcb

Please sign in to comment.