gui.rs

crates/veilvoice-cli/src/gui.rs

veilvoice-cli · 247 lines · read the source here · or on GitHub

veilvoice gui opens the desktop application from the command line.

Why this is not simply Command::new("veilvoice-gui")

A bare name is resolved through PATH, and on Windows the current directory is searched first. So veilvoice gui, run inside a downloads folder that happens to contain something called veilvoice-gui.exe, would start that instead. This is the one command whose whole job is to launch another program, which makes it a poor place to be relaxed about which.

So the search is explicit and in a stated order:

  1. Beside this binary. A portable folder holds both programs together, and somebody who unpacked a release and typed veilvoice gui means the one they unpacked.
  2. Where an installation puts it, from veilvoice_setup::install.
  3. PATH, last, and only through the system's own resolver.

If none of those has it, that is said plainly with the places that were looked in, rather than a "not found" that leaves somebody guessing.

It does not wait

The window is started and the command returns. A terminal held open for as long as a desktop application runs is a terminal somebody cannot use, and closing it would then close the window.

In plain words

Type veilvoice gui (or veilvoice g) and the VeilVoice window opens. The terminal is yours again immediately; closing it will not close the window.

It looks for the application next to the command first, then where an install would have put it, then on your system path. If it cannot find it anywhere, it tells you exactly where it looked.

WHAT THIS FILE CONTAINS

247 lines defining 5 functions (3 public), 0 types and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.

What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.

  • open line 125 · Open the window.
    reaches find, candidates, gui_name, on_path

WHAT CALLS WHAT

gui_name line 42 candidates line 54 find line 72 on_path line 99 open line 125 entry: a way in: public, and nothing in this file calls it api: public, and also used inside this file helper: private to this file dashed: a call that goes back up, or across a wrapped rank The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
    n_gui_name["gui_name<br/>line 42"]
    n_candidates["candidates<br/>line 54"]
    n_find["find<br/>line 72"]
    n_on_path["on_path<br/>line 99"]
    n_open(["open<br/>line 125"])
    n_candidates --> n_gui_name
    n_find --> n_candidates
    n_find --> n_gui_name
    n_find --> n_on_path
    n_on_path --> n_gui_name
    n_open --> n_find
    click n_gui_name href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/gui.rs#L42" "open the source"
    click n_candidates href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/gui.rs#L54" "open the source"
    click n_find href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/gui.rs#L72" "open the source"
    click n_on_path href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/gui.rs#L99" "open the source"
    click n_open href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-cli/src/gui.rs#L125" "open the source"
    classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
    class n_open entry
    classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
    class n_candidates,n_find api
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_gui_name,n_on_path helper

This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.

ITEMS

ItemLineDocumentation
gui_name fn42The executable's name on this platform.
candidates pub fn54Everywhere this looks, in order, and whether each had it.
find pub fn72The desktop application, wherever it is.
on_path fn99Ask the system where the program is, if anywhere.
open pub fn125Open the window.