-
Notifications
You must be signed in to change notification settings - Fork 7
feat(cli): add 'bs' shorthand alias for basilica command #295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughCreates and uses a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
scripts/web/install.sh (1)
530-532: Consider adding error handling for symlink creation.The script prints "Creating 'bs' alias..." but doesn't verify whether the symlink creation succeeds. If
lnfails, users won't be notified.Apply this diff to add basic error handling:
- # Create 'bs' alias symlink - print_step "Creating 'bs' alias..." - ln -sf "$INSTALL_DIR/$BINARY_NAME" "$INSTALL_DIR/bs" + # Create 'bs' alias symlink + print_step "Creating 'bs' alias..." + if ln -sf "$INSTALL_DIR/$BINARY_NAME" "$INSTALL_DIR/bs" 2>/dev/null; then + print_info "'bs' alias created successfully" + else + print_warning "Failed to create 'bs' alias" + ficrates/basilica-cli/src/cli/handlers/upgrade.rs (1)
134-156: Consider using a relative symlink for better portability.The current implementation creates an absolute symlink (pointing to the full path of the executable). If the binary is moved, the symlink will break. A relative symlink would be more robust.
Apply this diff to use a relative symlink:
#[cfg(unix)] fn ensure_alias_symlink() { use std::os::unix::fs::symlink; let Ok(current_exe) = std::env::current_exe() else { return; }; let Some(parent) = current_exe.parent() else { return; }; + let Some(binary_name) = current_exe.file_name() else { + return; + }; let alias_path = parent.join("bs"); // Remove existing symlink/file if present (ignore errors) let _ = std::fs::remove_file(&alias_path); // Create new symlink - match symlink(¤t_exe, &alias_path) { + match symlink(binary_name, &alias_path) { Ok(_) => println!("Created 'bs' alias"), Err(e) => eprintln!("Failed to create 'bs' alias: {}", e), } }This creates a relative symlink
bs -> basilicainstead ofbs -> /usr/local/bin/basilica, making it resilient to directory moves.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
crates/basilica-cli/src/cli/handlers/upgrade.rs(2 hunks)scripts/web/install.sh(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: lint-complex
- GitHub Check: build-cli (stable)
🔇 Additional comments (4)
scripts/web/install.sh (1)
618-618: LGTM!The completion message clearly informs users about both invocation options.
crates/basilica-cli/src/cli/handlers/upgrade.rs (3)
44-45: LGTM!Good placement to ensure the alias exists even when no update is available. The comment clearly explains the intent.
123-127: LGTM!The success message appropriately mentions both command options, consistent with the install script.
158-162: LGTM!The no-op implementation for non-Unix platforms is appropriate given the current scope, and the comment clearly explains why.
Adds a shorter
bsalias for thebasilicaCLI, making it faster to type commands.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.