Expand description
User settings, and the first-run download-folder prompt.
Settings live in the meta table of the same SQLite database as the
downloads, so there is one file to back up, move or delete — no separate
config file to drift out of sync with the download state.
The prompt has one hard rule: it must never block a script. It is shown
only when both stdin and stderr are terminals and no machine-output flag was
given. Everywhere else the platform’s Downloads folder is used silently, so
rget URL behaves identically in a terminal and in a pipeline.
Structs§
Enums§
- DirSource
- How the effective download folder was decided — reported under
--verboseand asserted in tests.
Constants§
- DOWNLOAD_
DIR_ KEY - Settings key for the folder downloads land in when no
--diris given.
Functions§
- ask
- The prompt itself, with I/O injected so it can be tested without a terminal.
- can_
prompt - May we interrupt the user with a question?
- normalise_
dir - Turn user input into an absolute, usable directory: expand
~, resolve relative paths against the working directory, and create it if needed. - platform_
download_ dir - The platform’s Downloads folder.
- prompt_
for_ download_ dir - The first-run prompt. Returns
Noneif we must not ask. - resolve_
download_ dir - Decide where this download should go.
- save_
download_ dir - saved_
download_ dir - The saved default download folder, if the user has ever chosen one.
- tildify
- Render a path with
~for display, so the prompt reads the way a person would write it.