mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-03-11 17:49:25 -05:00
feature: show symlink status on every _quarto.yml command
- Added show_symlink_status() method for simple, consistent display
- Shows symlink info at start of: build, preview, switch, clean commands
- Format: '🔗 _quarto.yml is symlink: config/_quarto-html.yml'
- Commands not using _quarto.yml (list, help) don't show symlink info
- Removed redundant symlink displays from individual build methods
- Provides immediate visibility of configuration state for every operation
This commit is contained in:
35
binder
35
binder
@@ -115,6 +115,14 @@ class BookBinder:
|
||||
'is_clean': html_commented == 0 and pdf_commented == 0
|
||||
}
|
||||
|
||||
def show_symlink_status(self):
|
||||
"""Show simple symlink status"""
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim]🔗 _quarto.yml is symlink: {target}[/dim]")
|
||||
else:
|
||||
console.print(f"[dim]⚠️ _quarto.yml is NOT a symlink[/dim]")
|
||||
|
||||
def show_status(self):
|
||||
"""Display beautiful status information"""
|
||||
status = self.get_status()
|
||||
@@ -566,12 +574,7 @@ class BookBinder:
|
||||
# Setup correct configuration symlink for the format
|
||||
self.setup_symlink(format_type)
|
||||
|
||||
# Show symlink status
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim] 🔗 _quarto.yml is symlink: {target}[/dim]")
|
||||
else:
|
||||
console.print(f"[dim] ⚠️ _quarto.yml is NOT a symlink[/dim]")
|
||||
|
||||
|
||||
try:
|
||||
# Ensure config is clean (remove any render restrictions)
|
||||
@@ -664,12 +667,7 @@ class BookBinder:
|
||||
# Setup correct configuration symlink for the format
|
||||
self.setup_symlink(format_type)
|
||||
|
||||
# Show symlink status
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim] 🔗 _quarto.yml is symlink: {target}[/dim]")
|
||||
else:
|
||||
console.print(f"[dim] ⚠️ _quarto.yml is NOT a symlink[/dim]")
|
||||
|
||||
|
||||
try:
|
||||
# Ensure config is clean (remove any render restrictions)
|
||||
@@ -905,12 +903,7 @@ class BookBinder:
|
||||
# Setup config
|
||||
config_name = self.setup_symlink(format_type)
|
||||
|
||||
# Show symlink status
|
||||
if self.active_config.is_symlink():
|
||||
target = self.active_config.readlink()
|
||||
console.print(f"[dim] 🔗 _quarto.yml is symlink: {target}[/dim]")
|
||||
else:
|
||||
console.print(f"[dim] ⚠️ _quarto.yml is NOT a symlink[/dim]")
|
||||
|
||||
|
||||
if format_type == "html":
|
||||
render_to = "html"
|
||||
@@ -1070,6 +1063,7 @@ def main():
|
||||
console.print("[red]❌ Usage: ./binder build <chapter[,chapter2,...]|all|-> <format>[/red]")
|
||||
console.print("[dim]Examples: ./binder build - html, ./binder build intro pdf[/dim]")
|
||||
return
|
||||
binder.show_symlink_status()
|
||||
chapters = sys.argv[2]
|
||||
format_type = sys.argv[3]
|
||||
if format_type not in ["html", "pdf"]:
|
||||
@@ -1087,10 +1081,12 @@ def main():
|
||||
if len(sys.argv) < 3:
|
||||
console.print("[red]❌ Usage: ./binder preview <chapter>[/red]")
|
||||
return
|
||||
binder.show_symlink_status()
|
||||
chapter = sys.argv[2]
|
||||
binder.preview(chapter)
|
||||
|
||||
elif command == "build-full":
|
||||
binder.show_symlink_status()
|
||||
format_type = sys.argv[2] if len(sys.argv) > 2 else "html"
|
||||
if format_type not in ["html", "pdf"]:
|
||||
console.print("[red]❌ Format must be 'html' or 'pdf'[/red]")
|
||||
@@ -1098,6 +1094,7 @@ def main():
|
||||
binder.build_full(format_type)
|
||||
|
||||
elif command == "preview-full":
|
||||
binder.show_symlink_status()
|
||||
format_type = sys.argv[2] if len(sys.argv) > 2 else "html"
|
||||
if format_type not in ["html", "pdf"]:
|
||||
console.print("[red]❌ Format must be 'html' or 'pdf'[/red]")
|
||||
@@ -1105,6 +1102,7 @@ def main():
|
||||
binder.preview_full(format_type)
|
||||
|
||||
elif command == "clean":
|
||||
binder.show_symlink_status()
|
||||
binder.clean()
|
||||
|
||||
elif command == "check":
|
||||
@@ -1116,6 +1114,7 @@ def main():
|
||||
if len(sys.argv) < 3:
|
||||
console.print("[red]❌ Usage: ./binder switch <html|pdf>[/red]")
|
||||
return
|
||||
binder.show_symlink_status()
|
||||
format_type = sys.argv[2]
|
||||
binder.switch(format_type)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user