Site name
Tooling & Workflow

CLI vs UI: When Each Makes Sense in Automation Tools

PMTheTechGuy
··2 min read
CLI vs UI: When Each Makes Sense in Automation Tools cover image

Should your automation tool have a CLI or a UI?

The answer: both. But build them separately.


When CLI Makes Sense

Use a CLI when:

  • The tool runs on a schedule (cron jobs, cloud functions).
  • The user is technical (developers, DevOps).
  • You need scriptability (chaining commands together).

Example:

python process.py --file invoice.pdf --output results.xlsx

This is perfect for automation pipelines.

When UI Makes Sense

Use a UI when:

  • The user is non-technical (analysts, operations).
  • The task requires visual feedback (preview, progress bars).
  • You need interactivity (upload files, adjust settings live).

Example: A Streamlit interface where users drag-and-drop PDFs and see results instantly.

The Best Approach: Separate Layers

Don't mix CLI logic with UI logic.

Your core processing function should look like this:

def process_file(file_path: str, output_format: str):
    # ... processing logic
    return result

Then build two interfaces on top:

CLI layer:

if __name__ == "__main__":
    import sys
    result = process_file(sys.argv[1], "xlsx")

UI layer (Streamlit):

uploaded_file = st.file_uploader("Upload PDF")
if uploaded_file:
    result = process_file(uploaded_file, "xlsx")
    st.write(result)

Same logic. Two interfaces.

My Default Pattern

I always build the CLI first.

Why? Because a CLI forces you to separate logic from UI.

Once the CLI works, adding a UI is trivial.

Conclusion

CLI for automation. UI for humans.

Build both. Keep them separate.

Tags

#CLI#UI#UX#Design
Newsletter

Stay updated with my latest projects

Get notified when I publish new tutorials, tools, and automation workflows. No spam, unsubscribe anytime.

Follow Me

Share This Post

You might also like

My Default Automation Stack in 2025 (And Why) cover image
Tooling & Workflow

My Default Automation Stack in 2025 (And Why)

Tools change. Principles don't. Here's a look at the 'Switcherboard' stack I reach for in 2025—and why I value clarity over complexity.

December 27, 20254 min read