Files
reqlite/crates/app/src/strings.rs
T
Torbjörn Molin 1e7f8678eb
windows / build (push) Successful in 5m0s
Added custom auth support
2026-11-09 12:56:54 +01:00

652 lines
25 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! Every user-visible string in the app, in one place.
//!
//! Fixed text is a `const`; text with values in it is a function returning a
//! `String`. Grouped by where it shows up. Protocol values (header names,
//! content types) and file formats are not UI strings and stay in the code.
/// Glyphs used as button labels and markers.
pub mod icon {
pub const CLOSE: &str = "×";
pub const ADD: &str = "+";
pub const RELOAD: &str = "⟳";
pub const MORE: &str = "…";
pub const DIRTY: &str = " •";
pub const IN_FLIGHT: &str = " ⏳";
pub const WARNING: &str = " ⚠";
pub const FOLDER: &str = "📁";
pub const FILE: &str = "📄";
pub const SHOW: &str = "👁";
pub const HIDE: &str = "🙈";
pub const MASKED: &str = "••••••••";
pub const MASKED_SHORT: &str = "••••";
pub const BULLET: &str = "•";
pub const NONE: &str = "—";
}
/// Words used in many places.
pub mod common {
pub const APP_NAME: &str = "reqlite";
pub const OK: &str = "OK";
pub const CANCEL: &str = "Cancel";
pub const SAVE: &str = "Save";
pub const CLOSE: &str = "Close";
pub const CLEAR: &str = "Clear";
pub const DELETE: &str = "Delete";
pub const OPEN: &str = "Open";
pub const RENAME: &str = "Rename…";
pub const REMOVE: &str = "Remove";
pub const APPLY: &str = "Apply";
pub const DISMISS: &str = "Dismiss";
pub const NONE: &str = "None";
pub const ALL: &str = "All";
pub const TEXT: &str = "Text";
pub const FILE: &str = "File";
pub const NAME: &str = "Name";
pub const VALUE: &str = "Value";
pub const SYSTEM: &str = "System";
pub const RELOAD_FROM_DISK: &str = "Reload from disk";
pub const NEW_REQUEST: &str = "New request";
pub const RENAME_REQUEST: &str = "Rename request";
pub const NEW_HTTP_FILE: &str = "New .http file";
pub const OPEN_COLLECTION_FOLDER: &str = "Open collection folder…";
pub const ENVIRONMENT_LABEL: &str = "Environment:";
pub const NO_AUTH: &str = "no auth";
/// A bulleted list item.
pub fn bullet(item: impl std::fmt::Display) -> String {
format!("{} {item}", super::icon::BULLET)
}
/// `n request` / `n requests`.
pub fn requests(n: usize) -> String {
format!("{n} request{}", if n == 1 { "" } else { "s" })
}
}
/// The menu bar, status bar and welcome screen.
pub mod main {
pub const FILE: &str = "File";
pub const NEW_TAB: &str = "New tab Ctrl+T";
pub const RECENT_COLLECTIONS: &str = "Recent collections";
pub const NONE_YET: &str = "None yet";
pub const SAVE: &str = "Save Ctrl+S";
pub const CLOSE_ALL_TABS: &str = "Close all tabs Ctrl+Shift+W";
pub const IMPORT_POSTMAN: &str = "Import Postman collection…";
pub const SETTINGS: &str = "Settings…";
pub const QUIT: &str = "Quit";
pub const VIEW: &str = "View";
pub const HISTORY: &str = "History";
pub const COOKIES: &str = "Cookies";
pub const QUICK_OPEN: &str = "Quick open… Ctrl+P";
pub const HELP: &str = "Help";
pub const ABOUT: &str = "About and shortcuts";
pub const EDIT_ENVS: &str = "Edit…";
pub const EDIT_ENVS_HOVER: &str = "Edit environments";
pub const NO_ENVIRONMENT: &str = "No environment";
pub const ENV_OWNER_HOVER: &str = "The collection of the active tab, or the one last clicked in the sidebar";
pub fn collection_environment(collection: &str) -> String {
format!("{collection} environment:")
}
pub const ORPHANED: &str = "This request is no longer in its file. Save writes it to a file you pick.";
pub const READY: &str = "Ready";
pub fn in_flight(n: usize) -> String {
format!("{n} in flight")
}
pub const WELCOME: &str = "Send HTTP requests and keep them as .http files.";
pub const WELCOME_NEW_REQUEST: &str = "New request (Ctrl+T)";
pub const WELCOME_OPEN_FOLDER: &str = "Open a collection folder…";
pub const WELCOME_TIP: &str = "Tip: paste a curl command into the URL bar to import it.";
}
/// The tab bar.
pub mod tabs {
pub const CLOSE_OTHERS: &str = "Close others";
pub const CLOSE_ALL: &str = "Close all";
pub const CLOSE_HOVER: &str = "Close (Ctrl+W)";
pub const NEW_TAB_HOVER: &str = "New tab (Ctrl+T)";
}
/// The URL bar and request editor.
pub mod request {
pub const URL_HINT: &str = "Enter a URL, or paste a curl command";
pub const CANCEL_HOVER: &str = "Stop the request";
pub const SEND: &str = "Send";
pub const SEND_HOVER: &str = "Send (Ctrl+Enter)";
pub const SAVE_DIRTY: &str = "Save •";
pub const SAVE_HOVER: &str = "Save to the .http file (Ctrl+S)";
pub const COPY_AS_CURL: &str = "Copy as curl";
pub const COPY_AS_HTTP: &str = "Copy as .http";
pub const FOLLOW_REDIRECTS: &str = "Follow redirects";
pub fn params_tab(n: usize) -> String {
format!("Params ({n})")
}
pub fn headers_tab(n: usize) -> String {
format!("Headers ({n})")
}
pub const BODY_TAB: &str = "Body";
pub const BODY_TAB_SET: &str = "Body •";
pub const AUTH_TAB: &str = "Auth";
pub const SOURCE_TAB: &str = "Source";
pub const SOURCE_TAB_ERROR: &str = "Source ⚠";
pub const KEY: &str = "Key";
pub const ADD_PARAMETER: &str = "Add parameter";
pub const PARAMS_NOTE: &str = "Parameters are kept in the URL, exactly as typed.";
pub const ADD_HEADER: &str = "Add header";
pub const DISABLED_HEADER_HOVER: &str = "Disabled headers are kept as `# Name: value` comments";
pub const SOURCE_NOTE: &str =
"The request as it is stored in the .http file. Comments and response handlers are kept; scripts are never run.";
}
/// The request body editor.
pub mod body {
pub const MULTIPART_FORM: &str = "Multipart form";
pub const NO_BODY: &str = "This request has no body.";
pub const CONTENT_TYPE_LABEL: &str = "Content-Type:";
pub const JSON: &str = "JSON";
pub const XML: &str = "XML";
pub const FORM: &str = "Form";
pub const FORMAT: &str = "Format";
pub const FORMAT_HOVER: &str = "Pretty-print the JSON";
pub fn too_large(kb: usize) -> String {
format!(
"The body is {kb} KB, too large to edit here. Edit it in the .http file, or move it to a file (`< ./body.json`)."
)
}
pub const FILE_LABEL: &str = "File:";
pub const BROWSE: &str = "Browse…";
pub const SUBSTITUTE: &str = "Replace {{variables}} in the file (`<@`)";
pub const RELATIVE_PATHS: &str = "Relative paths are relative to the .http file.";
pub const PART_KIND: &str = "Kind";
pub const PART_VALUE: &str = "Value / file";
pub const PART_CONTENT_TYPE: &str = "Content-Type";
pub const ADD_FIELD: &str = "Add field";
}
/// The Auth tab and the folder auth dialog.
pub mod auth {
pub const TYPE_LABEL: &str = "Type:";
pub const INHERIT: &str = "Inherit";
pub const NOT_SET: &str = "Not set";
pub const BASIC: &str = "Basic";
pub const BEARER: &str = "Bearer token";
pub const CUSTOM_HEADER: &str = "Custom header";
pub const HEADER_NAME: &str = "Header";
pub const VALUE: &str = "Value";
pub const CUSTOM_NOTE: &str =
"Sent as `Header: value` instead of Authorization; a request marks it with `# @auth-header Header`.";
pub const USERNAME: &str = "Username";
pub const PASSWORD: &str = "Password";
pub const BASIC_NOTE: &str =
"Written as `Authorization: Basic user password`; it is base64-encoded when sent, like JetBrains does.";
pub const TOKEN: &str = "Token";
pub const HEADER_VALUE: &str = "Header value";
pub const NO_AUTH_SET: &str = "No Authorization header, not even the folder's (`# @no-auth`).";
pub const CUSTOM: &str = "Custom Authorization header:";
pub const SECRETS_NOTE: &str = "Auth is just a header; put secrets in the private env file.";
pub const NOT_IN_COLLECTION: &str = "Not in a collection, so there is nothing to inherit.";
pub const USES: &str = "Uses";
pub fn from_folder(folder: &str) -> String {
format!("from {folder}.")
}
pub fn folder_sends_none(folder: &str) -> String {
format!("No auth: {folder} is set to send none.")
}
pub const NO_FOLDER_AUTH: &str = "No auth: no folder above this request has auth set.";
pub const FOLDER_AUTH_BUTTON: &str = "Folder auth…";
pub const COLLECTION_DEFAULT_BUTTON: &str = "Collection default…";
pub const COLLECTION_DEFAULT_HOVER: &str = "Auth for every request in the collection that doesn't set its own";
pub const UNTITLED_NOTE: &str = "Untitled requests use the collection default.";
pub const COLLECTION_DEFAULT_TITLE: &str = "Collection default auth";
pub const FOLDER_AUTH_TITLE: &str = "Folder auth";
pub const ROOT_NOT_SET: &str = "Requests that don't set auth send none.";
pub fn parent_uses(value: &str, folder: &str) -> String {
format!("Uses `{value}` from {folder}.")
}
pub fn parent_none(folder: &str) -> String {
format!("No auth, as set on {folder}.")
}
pub const NO_PARENT_AUTH: &str = "No auth: no parent folder has auth set.";
pub const FOLDER_NONE: &str = "Requests here send no auth unless they set their own.";
pub const FOLDER_NOTE: &str =
"Used by requests in this folder and its subfolders that have no Authorization header of their own. \
Saved in .reqlite/folder.json (other .http tools ignore it).";
}
/// The "Consolidate auth" dialog and its result.
pub mod consolidate {
pub const TITLE: &str = "Consolidate auth";
pub fn intro(folder: &str) -> String {
format!(
"Let requests in {folder} inherit one shared auth instead of each carrying its own Authorization header."
)
}
pub const NOTHING: &str = "None of these requests has an Authorization header, and there is no auth to inherit.";
pub const SHARED_AUTH: &str = "Shared auth:";
pub fn choice(value: &str, n: usize) -> String {
format!("{value} ({})", super::common::requests(n))
}
pub fn will_save(folder: &str) -> String {
format!("It will be saved as the auth of {folder}.")
}
pub fn already_uses(folder: &str) -> String {
format!("{folder} already uses it.")
}
pub const NO_OWN: &str = "No request here has its own Authorization header.";
pub const REMOVE_FROM: &str = "Remove the Authorization header from:";
pub const MATCHING: &str = "Matching";
pub const MATCHING_HOVER: &str = "Only those that send the same thing";
pub fn would_send(has: &str, would: &str) -> String {
format!("has `{has}`; would send `{would}` instead")
}
pub fn affected(n: usize, target: &str) -> String {
format!("{n} request(s) without a header of their own would start sending `{target}`:")
}
pub fn affected_item(label: &str, now: &str) -> String {
format!("{} {label} (now: {now})", super::icon::BULLET)
}
pub const KEEP_AFFECTED: &str = "Keep what they send today";
pub const KEEP_AFFECTED_HOVER: &str = "Gives them their current header, or `# @no-auth`";
pub fn skipped_dirty(labels: &str) -> String {
format!("Skipped, because their tabs have unsaved edits: {labels}")
}
// The status message after applying; parts are joined with ", ".
pub fn set_folder(target: &str) -> String {
format!("set the folder auth to `{target}`")
}
pub fn dropped(n: usize) -> String {
format!("{n} request(s) now inherit it")
}
pub fn pinned(n: usize) -> String {
format!("{n} request(s) keep their auth explicitly")
}
pub fn skipped(n: usize) -> String {
format!("{n} with unsaved edits skipped")
}
pub const NOTHING_TO_CHANGE: &str = "Auth: nothing to change";
}
/// The response panel.
pub mod response {
pub fn sending(secs: f32) -> String {
format!("Sending… {secs:.1} s")
}
pub const EMPTY: &str = "Send the request to see the response here.";
pub fn millis(ms: u128) -> String {
format!("{ms} ms")
}
pub fn millis_f(ms: f32) -> String {
format!("{ms:.1} ms")
}
pub const SPILLED: &str = "(stored in a temp file)";
pub const SAVE_TO_FILE: &str = "Save to file…";
pub const COPY_BODY: &str = "Copy body";
pub const BODY_TAB: &str = "Body";
pub fn headers_tab(n: usize) -> String {
format!("Headers ({n})")
}
pub const TIMINGS_TAB: &str = "Timings";
pub fn final_url(url: &str) -> String {
format!("Final URL: {url}")
}
pub const PREPARING: &str = "Preparing the body…";
pub const NO_BODY: &str = "No body.";
pub const PRETTY: &str = "Pretty";
pub const RAW: &str = "Raw";
pub const BINARY: &str = "Binary body, shown as hex. Use “Save to file” to keep it.";
pub const TRUNCATED: &str = "Only the start of this large body is shown.";
pub const FIND_BUTTON: &str = "🔍 Find";
pub const FIND_HOVER: &str = "Search the body (Ctrl+F)";
pub const FIND_HINT: &str = "Find";
pub const NO_MATCHES: &str = "no matches";
pub const PREV: &str = "Prev";
pub const NEXT: &str = "Next";
pub const TOTAL: &str = "Total";
}
/// The collection tree.
pub mod sidebar {
pub const COLLECTIONS: &str = "Collections";
pub const OPEN: &str = "Open…";
pub const OPEN_HOVER: &str = "Open another collection folder";
pub const NO_COLLECTION: &str = "No collection open.";
pub const WHAT_IS_A_COLLECTION: &str = "A collection is a folder of .http files.";
pub const OPEN_FOLDER: &str = "Open folder…";
pub const RECENT: &str = "Recent";
pub fn collection_hover(root: impl std::fmt::Display) -> String {
format!("{root}\nClick to use its environments for new tabs")
}
pub const NEW_HTTP_FILE: &str = "New .http file…";
pub const DEFAULT_AUTH: &str = "Default auth…";
pub const CLOSE_COLLECTION: &str = "Close collection";
pub const CLOSE_COLLECTION_HOVER: &str = "Close this collection";
pub const PRIVATE_NOT_IGNORED: &str =
"http-client.private.env.json is not in .gitignore, so secrets could be committed.";
pub const ADD_TO_GITIGNORE: &str = "Add to .gitignore";
pub fn env_error(e: &str) -> String {
format!("Environments: {e}")
}
pub fn folder_error(e: &str) -> String {
format!("Folder settings: {e}")
}
pub const NO_FILES: &str = "No .http files yet.";
pub const CREATE_ONE: &str = "Create one";
pub const AUTH_HOVER: &str = "Auth for the requests in here that don't set their own";
pub const CONSOLIDATE: &str = "Consolidate auth…";
pub const CONSOLIDATE_HOVER: &str = "Make requests in here inherit one shared auth";
pub fn folder(name: &str) -> String {
format!("{} {name}", super::icon::FOLDER)
}
pub fn file(name: &str) -> String {
format!("{} {name}", super::icon::FILE)
}
pub fn folder_auth_hover(value: &str) -> String {
format!("Auth: {value}")
}
pub const DUPLICATE: &str = "Duplicate";
pub const MOVE_TO: &str = "Move to";
pub const DELETE: &str = "Delete…";
pub const NO_REQUESTS: &str = "(no requests)";
pub const RENAME_FILE: &str = "Rename file…";
pub const RENAME_FILE_TITLE: &str = "Rename file";
pub const DUPLICATE_FILE: &str = "Duplicate file";
pub const DELETE_FILE: &str = "Delete file…";
pub const NO_URL: &str = "(no URL)";
}
/// Modal dialogs.
pub mod dialog {
pub const UNSAVED: &str = "Unsaved changes";
pub fn tab_unsaved(title: &str) -> String {
format!("“{title}” has changes that are not saved.")
}
pub const SAVE_AND_CLOSE: &str = "Save and close";
pub const DISCARD: &str = "Discard";
pub fn tabs_unsaved(n: usize) -> String {
format!("{n} tab(s) have changes that are not saved:")
}
pub const DISCARD_AND_CLOSE: &str = "Discard and close";
pub const KEEP_OPEN: &str = "Keep them open";
pub const QUIT_TITLE: &str = "Quit reqlite?";
pub fn quit_unsaved(n: usize) -> String {
format!("{n} tab(s) have unsaved changes; they will be lost.")
}
pub const QUIT_WITHOUT_SAVING: &str = "Quit without saving";
pub const CONFLICT_TITLE: &str = "File changed on disk";
pub fn conflict(path: impl std::fmt::Display) -> String {
format!("{path} was changed outside reqlite, and this tab has unsaved edits.")
}
pub const RELOAD_HOVER: &str = "Discard my edits";
pub const KEEP_MINE: &str = "Keep my version";
pub const KEEP_MINE_HOVER: &str = "Saving will overwrite this request in the new file";
pub const DELETE_TITLE: &str = "Delete?";
pub fn delete_request(label: &str) -> String {
format!("the request “{label}”")
}
pub fn delete_file(path: impl std::fmt::Display) -> String {
format!("the file {path}")
}
pub fn delete_body(what: &str) -> String {
format!("This deletes {what} from disk.")
}
pub const IMPORT_TITLE: &str = "Import finished";
pub fn import_wrote(files: usize, root: impl std::fmt::Display) -> String {
format!("Wrote {files} .http file(s) to {root}.")
}
pub fn warnings(n: usize) -> String {
format!("{n} warning(s):")
}
pub const NEW_ENVIRONMENT: &str = "New environment";
}
/// The Settings window.
pub mod settings {
pub const TITLE: &str = "Settings";
pub const TIMEOUT: &str = "Default timeout";
pub const SECONDS_SUFFIX: &str = " s";
pub const TIMEOUT_NOTE: &str = "0 = none; `# @timeout` wins";
pub const PROXY: &str = "Proxy";
pub const MANUAL: &str = "Manual";
pub const PROXY_HINT: &str = "http://user:pass@proxy:3128";
pub const TLS: &str = "TLS";
pub const VERIFY_TLS: &str = "Verify certificates";
pub const SYSTEM_STORE: &str = "System store only";
pub const ADD_CA: &str = "Add CA file…";
pub const THEME: &str = "Theme";
pub const LIGHT: &str = "Light";
pub const DARK: &str = "Dark";
pub const FONT_SIZE: &str = "Font size";
pub fn percent(v: f64) -> String {
format!("{:.0}%", v * 100.0)
}
pub const PARALLEL: &str = "Parallel requests";
pub const AT_ONCE: &str = "at once";
pub const HISTORY_SIZE: &str = "History size";
}
/// The History window.
pub mod history {
pub const TITLE: &str = "History";
pub fn count(n: usize) -> String {
format!("{n} request(s)")
}
pub const ERR: &str = "ERR";
pub fn hover(url: &str, ms: u64, env: Option<&str>) -> String {
format!(
"{url}\n{ms} ms{}",
env.map(|v| format!(", env {v}")).unwrap_or_default()
)
}
pub const RESTORE_HOVER: &str = "Restore into a new tab";
}
/// The Cookies window.
pub mod cookies {
pub const TITLE: &str = "Cookies";
pub const NOTE: &str = "Cookies are kept in memory per collection; `# @no-cookie-jar` skips them.";
pub const EMPTY: &str = "No cookies yet.";
pub const CLEAR_ALL: &str = "Clear all";
pub const DOMAIN: &str = "Domain";
pub const PATH: &str = "Path";
}
/// The About window.
pub mod about {
pub const TITLE: &str = "About reqlite";
pub fn heading(version: &str) -> String {
format!("reqlite {version}")
}
pub const TAGLINE: &str = "A small API client for .http files.";
pub const SHORTCUTS: &str = "Shortcuts";
pub const KEYS: [(&str, &str); 8] = [
("Ctrl+Enter", "Send"),
("Ctrl+S", "Save"),
("Ctrl+T", "New tab"),
("Ctrl+W", "Close tab"),
("Ctrl+Shift+W", "Close all tabs"),
("Ctrl+L", "Focus the URL bar"),
("Ctrl+P", "Quick-open a request"),
("Ctrl+F", "Find in the response"),
];
}
/// The environment editor window.
pub mod env {
pub fn title(collection: &str, dirty: bool) -> String {
format!(
"Environments: {collection}{}",
if dirty { super::icon::DIRTY } else { "" }
)
}
pub const SHARED: &str = "$shared (all environments)";
pub const NEW: &str = "New…";
pub const PRIVATE: &str = "Private";
pub const STRUCTURED: &str = "(object; edit the JSON file)";
pub const PRIVATE_HOVER: &str = "Stored in http-client.private.env.json (keep it out of git)";
pub const SHOW_HIDE_HOVER: &str = "Show / hide";
pub const ADD_VARIABLE: &str = "Add variable";
pub const SAVE_NOTE: &str = "Writes http-client.env.json and http-client.private.env.json.";
}
/// The quick-open popup.
pub mod quick_open {
pub const TITLE: &str = "Open request";
pub const HINT: &str = "Type to find a request…";
pub const NO_MATCHES: &str = "No matching requests";
}
/// Variable hover text in editors.
pub mod vars {
pub fn undefined(name: &str) -> String {
format!("{{{{{name}}}}} is not defined in the selected environment")
}
pub fn builtin(name: &str) -> String {
format!("{{{{{name}}}}}: built-in dynamic value")
}
pub const FROM_PRIVATE_ENV: &str = "private env";
pub const FROM_ENV: &str = "env";
pub const FROM_FILE: &str = "file variable";
pub const FROM_BUILTIN: &str = "built-in";
pub fn resolved(value: &str, result: &str) -> String {
format!("{value} -> {result}")
}
pub fn hover(name: &str, shown: &str, from: &str) -> String {
format!("{name} = {shown} ({from})")
}
}
/// Sizes.
pub mod units {
pub fn bytes(n: u64) -> String {
format!("{n} B")
}
pub fn kilobytes(kb: f64) -> String {
format!("{kb:.1} KB")
}
pub fn megabytes(mb: f64) -> String {
format!("{mb:.1} MB")
}
}
/// Native file dialogs.
pub mod pick {
pub const OPEN_COLLECTION: &str = "Open collection folder";
pub const SAVE_REQUEST: &str = "Save request to .http file";
pub const HTTP_FILTER: &str = "HTTP request files";
pub const BODY_FILE: &str = "Request body file";
pub const CA_FILE: &str = "CA certificate bundle (PEM)";
pub const PEM_FILTER: &str = "PEM";
pub const POSTMAN_FILE: &str = "Postman collection (v2.1) to import";
pub const POSTMAN_FILTER: &str = "Postman collection";
pub const IMPORT_TARGET: &str = "Folder to write the .http files to";
pub const SAVE_RESPONSE: &str = "Save response body";
}
/// Status bar messages and errors shown in a tab.
pub mod msg {
use std::fmt::Display;
pub const NO_REQUEST_IN_TEXT: &str = "No request in that text";
pub const CURL_IMPORTED: &str = "Imported the curl command";
pub fn curl_import_failed(e: impl Display) -> String {
format!("Could not import curl command: {e}")
}
pub const NO_REQUEST_LINE: &str = "No request line found";
pub fn not_one_request(n: usize) -> String {
format!("The source must contain exactly one request (found {n})")
}
pub const CANCELLED: &str = "Cancelled";
pub fn overlaps(root: impl Display, other: impl Display) -> String {
format!("{root} overlaps the open collection {other}; close that one first")
}
pub fn collection_failed(e: impl Display) -> String {
format!("Could not open the collection: {e}")
}
pub fn already_exists(path: impl Display) -> String {
format!("{path} already exists")
}
pub fn pick_empty_folder(path: impl Display) -> String {
format!("{path} already exists; pick an empty folder")
}
pub const NEED_COLLECTION_FOR_ENVS: &str =
"Open a collection folder first; environments live next to the .http files";
pub const NEED_COLLECTION_FOR_QUICK_OPEN: &str = "Open a collection to quick-open its requests";
pub const COPIED_CURL: &str = "Copied as curl";
pub fn curl_failed(e: impl Display) -> String {
format!("Cannot build the curl command: {e}")
}
pub const COPIED_HTTP: &str = "Copied as .http";
pub fn fix_source(e: impl Display) -> String {
format!("Fix the source first: {e}")
}
pub fn cannot_save(e: impl Display) -> String {
format!("Cannot save: {e}")
}
pub fn not_loaded(path: impl Display) -> String {
format!("{path} is not loaded")
}
pub const NO_LONGER_IN_FILE: &str = "The request is no longer in its file; use Save As";
pub fn invalid_json(e: impl Display) -> String {
format!("Not valid JSON: {e}")
}
pub fn settings_file(e: impl Display) -> String {
format!("settings.toml: {e}")
}
pub fn added_to_gitignore(file: &str) -> String {
format!("Added {file} to .gitignore")
}
/// An error about a particular file.
pub fn file_error(path: impl Display, e: impl Display) -> String {
format!("{path}: {e}")
}
pub fn postman_failed(e: impl Display) -> String {
format!("Postman import failed: {e}")
}
pub fn saved(path: impl Display) -> String {
format!("Saved {path}")
}
pub fn settings_save_failed(e: impl Display) -> String {
format!("Could not save settings: {e}")
}
pub fn cannot_watch(path: impl Display, e: impl Display) -> String {
format!("Cannot watch {path}: {e}")
}
}
/// Names the app gives new things (written to files, so users see them).
pub mod names {
pub const REQUEST: &str = "Request";
pub fn copy_of(base: &str) -> String {
format!("{base} copy")
}
pub fn file_copy(stem: &str, ext: &str) -> String {
format!("{stem} copy.{ext}")
}
pub fn file_copy_n(stem: &str, n: usize, ext: &str) -> String {
format!("{stem} copy {n}.{ext}")
}
pub fn numbered(base: &str, n: usize) -> String {
format!("{base} {n}")
}
pub fn collection(name: &str) -> String {
format!("the collection “{name}”")
}
pub fn folder(path: impl std::fmt::Display) -> String {
format!("the folder {path}")
}
}