Skip to content

[FEAT] - Enhance CLI for GUI-less operations and scripting #13

Description

@dylanlangston

Is your feature request related to a problem? Please describe.

Currently, AvaloniaXKCD primarily operates as a GUI application. Users who want to retrieve comic information, integrate XKCD into scripts, or work from the terminal have limited options. The existing command-line interface is basic and could be significantly expanded.

Describe the solution you'd like

Expand command-line capabilities so users can interact with XKCD content directly from the terminal without launching the Avalonia GUI. The project already uses System.CommandLine for parsing arguments in https://github.com/dylanlangston/Axkcd/blob/master/src/AvaloniaXKCD/CommandLineParser.cs.

  • Review existing CLI parsing logic and commands
  • Extend CommandLineParser.cs to add new commands. Suggestions:
    • --get <comicNumber> or get-info — Retrieve and print comic title, alt text, date, and URL
    • --latest — Fetch and display the most recent comic
    • --random — Pull and display a random comic
    • --open <comicNumber> or open-browser — Launch specified comic in default web browser using Process.Start
  • Format output cleanly for terminal display (support plain text and JSON modes for scripting)
  • Integrate ExplainXKCD lookups (e.g., --explain <comicNumber>)
  • Implement proper error handling and user feedback for invalid inputs or network issues
  • Leverage XKCDCore
  • Update README and add CLI usage documentation with examples
  • Ensure cross-platform compatibility for all CLI commands

Describe alternatives you've considered

  • Separate CLI-only tool, but integrating into main app reduces maintenance/distribution overhead.
  • Basic --help only, but expanded commands provide real utility for power users.

Additional context

Acceptance Criteria:

  • CLI mode can retrieve and display comics without launching GUI
  • Commands are clearly described in --help output
  • JSON output mode works for scripting/integration use cases
  • All commands work cross-platform
  • Error messages are helpful and actionable
  • Documentation and examples are included in README
  • CLI operations properly leverage existing XKCDCore logic

This makes AvaloniaXKCD useful for automation, shell integration, and users who prefer terminal interfaces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions