Update version to 0.1.3 and simplify version output
- Update Cargo.toml version to 0.1.3 - Custom version flag implementation to output version only - Update GitHub Actions to handle simplified version output - Update Gitea Actions (action.yml) for version handling - Now `ailog -V` or `ailog --version` outputs just "0.1.3" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
4
.github/workflows/gh-pages-fast.yml
vendored
4
.github/workflows/gh-pages-fast.yml
vendored
@ -35,7 +35,7 @@ jobs:
|
|||||||
# Check current binary version if exists
|
# Check current binary version if exists
|
||||||
mkdir -p ./bin
|
mkdir -p ./bin
|
||||||
if [ -f "./bin/ailog" ]; then
|
if [ -f "./bin/ailog" ]; then
|
||||||
CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' || echo "unknown")
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
echo "Current version: $CURRENT_VERSION"
|
echo "Current version: $CURRENT_VERSION"
|
||||||
else
|
else
|
||||||
CURRENT_VERSION="none"
|
CURRENT_VERSION="none"
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
https://github.com/${{ github.repository }}/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf -
|
https://github.com/${{ github.repository }}/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf -
|
||||||
mv ailog ./bin/ailog
|
mv ailog ./bin/ailog
|
||||||
chmod +x ./bin/ailog
|
chmod +x ./bin/ailog
|
||||||
echo "Updated to version: $(./bin/ailog --version)"
|
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
|
||||||
else
|
else
|
||||||
echo "Binary is up to date"
|
echo "Binary is up to date"
|
||||||
chmod +x ./bin/ailog
|
chmod +x ./bin/ailog
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ailog"
|
name = "ailog"
|
||||||
version = "0.1.0"
|
version = "0.1.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["syui"]
|
authors = ["syui"]
|
||||||
description = "A static blog generator with AI features"
|
description = "A static blog generator with AI features"
|
||||||
|
@ -69,7 +69,7 @@ runs:
|
|||||||
# Check current binary version if exists
|
# Check current binary version if exists
|
||||||
mkdir -p ./bin
|
mkdir -p ./bin
|
||||||
if [ -f "./bin/ailog" ]; then
|
if [ -f "./bin/ailog" ]; then
|
||||||
CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' 2>/dev/null || echo "unknown")
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
echo "Current version: $CURRENT_VERSION"
|
echo "Current version: $CURRENT_VERSION"
|
||||||
else
|
else
|
||||||
CURRENT_VERSION="none"
|
CURRENT_VERSION="none"
|
||||||
@ -83,13 +83,13 @@ runs:
|
|||||||
if curl -sL https://github.com/syui/ailog/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf - 2>/dev/null; then
|
if curl -sL https://github.com/syui/ailog/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf - 2>/dev/null; then
|
||||||
mv ailog ./bin/ailog
|
mv ailog ./bin/ailog
|
||||||
chmod +x ./bin/ailog
|
chmod +x ./bin/ailog
|
||||||
echo "Downloaded binary: $(./bin/ailog --version)"
|
echo "Downloaded binary: $(./bin/ailog --version 2>/dev/null)"
|
||||||
else
|
else
|
||||||
echo "Download failed, building from source..."
|
echo "Download failed, building from source..."
|
||||||
if command -v cargo >/dev/null 2>&1; then
|
if command -v cargo >/dev/null 2>&1; then
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp ./target/release/ailog ./bin/ailog
|
cp ./target/release/ailog ./bin/ailog
|
||||||
echo "Built from source: $(./bin/ailog --version)"
|
echo "Built from source: $(./bin/ailog --version 2>/dev/null)"
|
||||||
else
|
else
|
||||||
echo "Error: Neither download nor cargo build available"
|
echo "Error: Neither download nor cargo build available"
|
||||||
exit 1
|
exit 1
|
||||||
|
21
src/main.rs
21
src/main.rs
@ -18,10 +18,14 @@ mod mcp;
|
|||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "ailog")]
|
#[command(name = "ailog")]
|
||||||
#[command(about = "A static blog generator with AI features")]
|
#[command(about = "A static blog generator with AI features")]
|
||||||
#[command(version)]
|
#[command(disable_version_flag = true)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
|
/// Print version information
|
||||||
|
#[arg(short = 'V', long = "version")]
|
||||||
|
version: bool,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Commands,
|
command: Option<Commands>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
@ -135,8 +139,19 @@ enum OauthCommands {
|
|||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
// Handle version flag
|
||||||
|
if cli.version {
|
||||||
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Require subcommand if no version flag
|
||||||
|
let command = cli.command.ok_or_else(|| {
|
||||||
|
anyhow::anyhow!("No subcommand provided. Use --help for usage information.")
|
||||||
|
})?;
|
||||||
|
|
||||||
match cli.command {
|
match command {
|
||||||
Commands::Init { path } => {
|
Commands::Init { path } => {
|
||||||
commands::init::execute(path).await?;
|
commands::init::execute(path).await?;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user