Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
2838e494d6
|
|||
5838adf5a6
|
|||
f52249c292
|
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
|
||||
mkdir -p ./bin
|
||||
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"
|
||||
else
|
||||
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 -
|
||||
mv ailog ./bin/ailog
|
||||
chmod +x ./bin/ailog
|
||||
echo "Updated to version: $(./bin/ailog --version)"
|
||||
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
|
||||
else
|
||||
echo "Binary is up to date"
|
||||
chmod +x ./bin/ailog
|
||||
|
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@ -11,6 +11,10 @@ on:
|
||||
required: true
|
||||
default: 'v0.1.0'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
OPENSSL_STATIC: true
|
||||
@ -103,14 +107,15 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.asset_name }}
|
||||
path: |
|
||||
${{ matrix.asset_name }}.tar.gz
|
||||
${{ matrix.asset_name }}.zip
|
||||
path: ${{ matrix.asset_name }}.tar.gz
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -159,8 +164,6 @@ jobs:
|
||||
body_path: release_notes.md
|
||||
draft: false
|
||||
prerelease: ${{ contains(steps.tag_name.outputs.tag, 'alpha') || contains(steps.tag_name.outputs.tag, 'beta') || contains(steps.tag_name.outputs.tag, 'rc') }}
|
||||
files: |
|
||||
artifacts/*/ailog-*.tar.gz
|
||||
artifacts/*/ailog-*.zip
|
||||
files: artifacts/*/ailog-*.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ailog"
|
||||
version = "0.1.0"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
authors = ["syui"]
|
||||
description = "A static blog generator with AI features"
|
||||
|
@ -69,7 +69,7 @@ runs:
|
||||
# Check current binary version if exists
|
||||
mkdir -p ./bin
|
||||
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"
|
||||
else
|
||||
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
|
||||
mv ailog ./bin/ailog
|
||||
chmod +x ./bin/ailog
|
||||
echo "Downloaded binary: $(./bin/ailog --version)"
|
||||
echo "Downloaded binary: $(./bin/ailog --version 2>/dev/null)"
|
||||
else
|
||||
echo "Download failed, building from source..."
|
||||
if command -v cargo >/dev/null 2>&1; then
|
||||
cargo build --release
|
||||
cp ./target/release/ailog ./bin/ailog
|
||||
echo "Built from source: $(./bin/ailog --version)"
|
||||
echo "Built from source: $(./bin/ailog --version 2>/dev/null)"
|
||||
else
|
||||
echo "Error: Neither download nor cargo build available"
|
||||
exit 1
|
||||
|
@ -517,25 +517,21 @@ a.view-markdown:any-link {
|
||||
margin: 16px 0;
|
||||
font-size: 14px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* File name display for code blocks */
|
||||
/* File name display for code blocks - top bar style */
|
||||
.article-body pre[data-filename]::before {
|
||||
content: attr(data-filename);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
display: block;
|
||||
background: #2D2D30;
|
||||
color: #CCCCCC;
|
||||
padding: 4px 12px;
|
||||
color: #AE81FF;
|
||||
padding: 8px 16px;
|
||||
font-size: 12px;
|
||||
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
|
||||
border-bottom-left-radius: 4px;
|
||||
border: 1px solid #3E3D32;
|
||||
border-top: none;
|
||||
border-right: none;
|
||||
z-index: 1;
|
||||
border-bottom: 1px solid #3E3D32;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.article-body pre code {
|
||||
@ -548,6 +544,11 @@ a.view-markdown:any-link {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* Adjust padding when filename is present */
|
||||
.article-body pre[data-filename] code {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
/* Inline code (not in pre blocks) */
|
||||
.article-body code {
|
||||
background: var(--light-white);
|
||||
@ -853,6 +854,16 @@ a.view-markdown:any-link {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* Mobile filename display */
|
||||
.article-body pre[data-filename]::before {
|
||||
padding: 6px 12px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.article-body pre[data-filename] code {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.article-body code {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
21
src/main.rs
21
src/main.rs
@ -18,10 +18,14 @@ mod mcp;
|
||||
#[derive(Parser)]
|
||||
#[command(name = "ailog")]
|
||||
#[command(about = "A static blog generator with AI features")]
|
||||
#[command(version)]
|
||||
#[command(disable_version_flag = true)]
|
||||
struct Cli {
|
||||
/// Print version information
|
||||
#[arg(short = 'V', long = "version")]
|
||||
version: bool,
|
||||
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
command: Option<Commands>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@ -136,7 +140,18 @@ enum OauthCommands {
|
||||
async fn main() -> Result<()> {
|
||||
let cli = Cli::parse();
|
||||
|
||||
match cli.command {
|
||||
// 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 command {
|
||||
Commands::Init { path } => {
|
||||
commands::init::execute(path).await?;
|
||||
}
|
||||
|
Reference in New Issue
Block a user