Compare commits

..

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

3 changed files with 22 additions and 33 deletions

View file

@ -6,29 +6,22 @@ on:
env:
DL_DIR: /srv/breadway-dl
ECOSYSTEM_DIR: /tmp/bread-ecosystem-ci
PATH: /home/breadway/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem
jobs:
build:
runs-on: hestia
defaults:
run:
working-directory: /tmp/breadpaper-build
runs-on: [self-hosted, hestia]
steps:
- name: checkout
working-directory: /tmp
run: |
rm -rf /tmp/breadpaper-build
git clone --branch "${GITHUB_REF_NAME}" --depth 1 \
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" /tmp/breadpaper-build
"https://git.breadway.dev/${GITHUB_REPOSITORY}.git" .
- name: build
run: /home/breadway/.cargo/bin/cargo build --release --locked
run: cargo build --release --locked
- name: test
run: /home/breadway/.cargo/bin/cargo test --release --locked
run: cargo test --release --locked
- name: prepare artifacts
run: |
@ -43,11 +36,13 @@ jobs:
ln -sfn "${VERSION}" "${DL_DIR}/breadpaper/latest"
- name: ensure bread-ecosystem
working-directory: /tmp
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}"
fi
- name: regenerate index.json
working-directory: /tmp
run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh"

View file

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

View file

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