Compare commits

..

No commits in common. "main" and "v0.1.6" have entirely different histories.
main ... v0.1.6

3 changed files with 18 additions and 20 deletions

View file

@ -6,7 +6,7 @@ on:
env: env:
DL_DIR: /srv/breadway-dl DL_DIR: /srv/breadway-dl
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs: jobs:
@ -45,8 +45,12 @@ jobs:
- name: ensure bread-ecosystem - name: ensure bread-ecosystem
working-directory: /tmp working-directory: /tmp
run: | run: |
rm -rf "${ECOSYSTEM_DIR}" if [[ -d "${ECOSYSTEM_DIR}/.git" ]]; then
git -C "${ECOSYSTEM_DIR}" pull --ff-only
else
mkdir -p "$(dirname "${ECOSYSTEM_DIR}")"
git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}" git clone https://github.com/Breadway/bread-ecosystem.git "${ECOSYSTEM_DIR}"
fi
- name: regenerate index.json - name: regenerate index.json
working-directory: /tmp working-directory: /tmp

View file

@ -4,23 +4,19 @@ use std::process;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
#[derive(Parser)] #[derive(Parser)]
#[command( #[command(name = "breadpaper", about = "Wallpaper manager for the bread desktop")]
name = "breadpaper",
version,
about = "Wallpaper manager for the bread desktop"
)]
struct Cli { struct Cli {
/// Image file to set as wallpaper (shorthand for `set`)
path: Option<PathBuf>,
#[command(subcommand)] #[command(subcommand)]
command: Option<Command>, command: Command,
} }
#[derive(Subcommand)] #[derive(Subcommand)]
enum Command { enum Command {
/// Set wallpaper, generate pywal palette, and reload bread themes /// Set wallpaper, generate pywal palette, and reload bread themes
Set { path: PathBuf }, Set {
/// Path to the image file
path: PathBuf,
},
/// Print the current wallpaper path /// Print the current wallpaper path
Get, Get,
} }
@ -28,11 +24,9 @@ enum Command {
fn main() { fn main() {
let cli = Cli::parse(); let cli = Cli::parse();
let result = match (cli.command, cli.path) { let result = match cli.command {
(Some(Command::Set { path }), _) | (None, Some(path)) => breadpaper::set(&path), Command::Set { path } => breadpaper::set(&path),
(Some(Command::Get), _) | (None, None) => { Command::Get => breadpaper::get().map(|p| println!("{}", p.display())),
breadpaper::get().map(|p| println!("{}", p.display()))
}
}; };
if let Err(e) = result { if let Err(e) = result {

View file

@ -5,13 +5,13 @@ use anyhow::{Context, Result, bail};
pub fn apply(path: &Path) -> Result<()> { pub fn apply(path: &Path) -> Result<()> {
let status = Command::new("awww") let status = Command::new("awww")
.arg("img") .arg("set")
.arg(path) .arg(path)
.status() .status()
.context("failed to run awww — is awww-daemon running?")?; .context("failed to run awww — is awww-daemon running?")?;
if !status.success() { if !status.success() {
bail!("awww img exited with {}", status); bail!("awww set exited with {}", status);
} }
Ok(()) Ok(())
} }