devto-cli 0.3.1

A CLI tool to manage dev.to articles
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::path::Path;

use anyhow::{bail, Result};
use inflections::case::is_kebab_case;

use crate::config::CONFIG_PATH;

pub(crate) fn basic(title: &str) -> Result<()> {
    if !is_kebab_case(title) {
        bail!("Title must be in kebab-case");
    }
    if !Path::new(CONFIG_PATH).exists() {
        bail!("Could not find config file: {CONFIG_PATH}");
    }
    Ok(())
}