{"id":33185690,"url":"https://github.com/Magic-JD/is-fast","last_synced_at":"2025-11-22T04:01:34.842Z","repository":{"id":279149855,"uuid":"937863725","full_name":"Magic-JD/is-fast","owner":"Magic-JD","description":"Check the internet as fast as possible","archived":false,"fork":false,"pushed_at":"2025-11-03T21:07:11.000Z","size":37790,"stargazers_count":160,"open_issues_count":3,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-03T21:20:39.923Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Magic-JD.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["magic-jd"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-02-24T03:06:36.000Z","updated_at":"2025-11-03T21:07:15.000Z","dependencies_parsed_at":"2025-02-24T04:23:30.631Z","dependency_job_id":"6eeeea1a-dec0-419c-965d-9421e25f299f","html_url":"https://github.com/Magic-JD/is-fast","commit_stats":null,"previous_names":["magic-jd/is-fast"],"tags_count":65,"template":false,"template_full_name":null,"purl":"pkg:github/Magic-JD/is-fast","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magic-JD%2Fis-fast","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magic-JD%2Fis-fast/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magic-JD%2Fis-fast/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magic-JD%2Fis-fast/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Magic-JD","download_url":"https://codeload.github.com/Magic-JD/is-fast/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Magic-JD%2Fis-fast/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285731803,"owners_count":27222214,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-22T02:00:05.934Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-11-16T05:00:20.099Z","updated_at":"2025-11-22T04:01:34.786Z","avatar_url":"https://github.com/Magic-JD.png","language":"Rust","funding_links":["https://github.com/sponsors/magic-jd"],"categories":["\u003ca name=\"online\"\u003e\u003c/a\u003eOnline search and resources"],"sub_categories":[],"readme":"# 🌍 Internet Search Fast from the Terminal\n\n`is-fast` is a TUI tool designed for quick and efficient internet searches directly from the terminal, ideal for\nenvironments where you don't have easy access to a browser. With simple commands, you can search the web, navigate\nresults, and view content seamlessly in the terminal. It supports custom configurations for styling, content extraction,\nand syntax highlighting, and allows direct URL viewing, local HTML file rendering, and history tracking. is-fast is\nfast, lightweight, and perfect for developers and terminal enthusiasts.\n\nThis tool makes **searching from the terminal fast and simple!** 🚀\n\n![demo](demos/main_demo.gif)\n[See more demos here!](demos/DEMOS.md)\n\n## ⚡ is-fast\n\n```sh\nis-fast \"search query\"\n```\n\nor\n\n```sh\nis-fast search query\n```\n\nNo waiting - just internet search fast in your terminal.  \n**It is fast!** ⚡\n\n---\n\n# Running the Project 🏃\n\n## Prerequisites\n\nBefore running the project, ensure you have the following installed:\n\n- [Rust](https://www.rust-lang.org/tools/install) (latest stable version) 🦀\n- [Cargo](https://doc.rust-lang.org/cargo/) (comes with Rust) 📦\n\n## Installing the program ![Latest Release](https://img.shields.io/github/v/release/Magic-JD/is-fast?include_prereleases) 🐧 🍏 🪟\n\n\n### Install prebuilt binaries via shell script\n\n```sh\ncurl --proto '=https' --tlsv1.2 -LsSf https://github.com/Magic-JD/is-fast/releases/latest/download/is-fast-installer.sh | sh\n```\n\n### Install prebuilt binaries via Homebrew\n\n```sh\nbrew install is-fast\n```\n\n### Install latest from source with cargo:\n\n```sh\ncargo install --git https://github.com/Magic-JD/is-fast.git\n```\n\n\n---\n\n### Table Of Contents\n\n- [🔧 Configuration Guide](#configuration-guide)\n  - [Default Configuration](#default-configuration)\n- [Tool Configuration](#tool-configuration)\n  - [🎨 Display Settings](#-display-settings)\n  - [🕰️ History Settings](#-history-settings)\n  - [⌨️ Keybinding Settings](#-keybinding-settings)\n  - [🔍 Search Configuration](#-search-configuration)\n  - [🔍 Selectors](#-selectors)\n  - [❓ Miscellaneous Configuration](#-miscellaneous-settings)\n  - [📝 Custom Site Configuration](#-custom-site-configuration)\n- [Site Configuration](#site-configuration)\n  - [🏷 Block Elements](#-block-elements)\n  - [🚫 Ignored Tags](#-ignored-tags)\n  - [➡️ Indent Elements](#-indent-elements)\n  - [🎨 Text Styles](#-text-styles)\n  - [🌈 Syntax Highlighting](#-syntax-highlighting)\n  - [🗄️ Cache Settings](#-cache-settings)\n  - [🛂 Headers](#-headers)\n- [🌍 Environment Variables](#-environment-variables)\n  - [Directory Configuration](#directory-configuration)\n  - [Search Api Configuration](#search-api-configuration)\n- [🌐 Using `is-fast` to Open URLs Directly](#-using-is-fast-to-open-urls-directly)\n  - [`--direct` / `-d`](#--direct---d)\n- [📃 Using `is-fast` with Local HTML Files](#-using-is-fast-with-local-html-files)\n  - [`--file` / `-f`](#--file---f)\n  - [`--url` / `-u`](#--url---u)\n- [ 🔄 Using `--piped`, `|` or `\u003e` to Output to Standard Output](#-using---piped--or--to-output-to-standard-output)\n- [📜 Viewing History in `is-fast`](#-viewing-history-in-is-fast)\n  - [`--history`](#--history)\n  - [`--no-history`](#--no-history)\n- [⚡ Caching in `is-fast`](#-caching-in-is-fast)\n  - [`--cache`](#--cache)\n  - [`--no-cache`](#--no-cache)\n  - [`--flash-cache`](#--flash-cache)\n  - [`--cache-mode`](#--cache-mode)\n- [🐞 Logging in `is-fast`](#-logging-in-is-fast)\n  - [`--log`](#--log)\n  - [`--log-level`](#--log-level)\n- [🔑 Customizing your results](#-customizing-your-results)\n  - [`--selector`](#--selector-s)\n  - [`--nth-element`](#--nth-element)\n  - [`--site`](#--site)\n  - [`--color`](#--color)\n  - [`--last`](#--last)\n  - [`--ignore`](#--ignore)\n  - [`--style-element`](#--style-element)\n  - [`--no-block`](#--no-block)\n  - [`--pretty-print`](#--pretty-print)\n- [🧹 Clearing Data](#-clearing-data) \n- [Example scripts](#example-scripts)\n- [Contributors](#contributors)\n---\n\n# Configuration Guide\n\nThis project supports both built-in and user-provided configurations for styles and content selection rules.\nConfiguration is handled using a TOML file, and a default configuration is embedded within the binary. Users can\noverride this configuration by placing a custom config file in their system's configuration directory. Changes will only\ntake effect once the program is run again.\n\n## Default Configuration\n\nA built-in configuration is included with the binary and is loaded automatically. The default configuration defines\nstyles for various elements and selectors for extracting content from different websites.\n\nUsers can override the default configuration by creating a TOML configuration file in their system’s configuration\ndirectory.\n\n### `--generate-config`\n\nCreates a `config.toml` in your system's configuration directory for customization:\n\n```sh\nis-fast --generate-config\n```\n\nThis will only run if the user does not already have a configuration file in that location.\n\n### Location of User Configuration File\n\nIf not generated the configuration file should be placed in:\n\n- **Linux**: `~/.config/is-fast/config.toml`\n- **macOS**: `~/Library/Application Support/is-fast/config.toml`\n- **Windows**: `%APPDATA%\\is-fast\\config.toml`\n\nIf the `--generate-config` command is used a copy of the default configuration will be placed there automatically.\n\nIf you don't want to use the default config location, setting the environment variable `IS_FAST_CONFIG_PATH` will enable you to\nplace it wherever you like.\n\n```sh\nexport IS_FAST_CONFIG_PATH=\"/full/path/to/config.toml\"\n```\n\n# Tool Configuration\n\nThese configuration values are set for the entire tool, and will be in effect for every site.\n\n## 🎨 Display Settings\n\nThe `[display]` section defines visual aspects of the output.\n\n### Border Color\n\nThis sets the border color used in the UI.\n\n### Page Margin\n\nA percentage of the page width that should be empty on either side.\n\n### Scroll Amount\n\nThe amount that page down/page up should scroll you. Default to full page. Valid values are `full`, `half` and a numerical value, which will scroll that number of lines.\n\n### Color Mode\n\nThis sets when color should be shown. The default behavior is for it to show in the TUI but not in the `--piped` or redirected output. Possible values are `tui` `never` and `always`. This can be overriden by applying the `--color` flag when running `is-fast`\n\n```toml\n[display]\nborder_color = \"#74c7ec\"\npage_margin = 10\nscroll = \"10\"\ncolor_mode = \"always\"\n```\n\n## 🕰️ History Settings\n\nThe `[history]` section defines how historical entries should be displayed.\n\n### Title Color\n\nSets the color for titles in the history list.\n\n### URL Color\n\nDefines the color for URLs in the history list.\n\n### Time Color\n\nSets the color for the time field in the history list.\n\n### Text Color\n\nDefines the text color of the search bar for history entries.\n\n### Search Type\n\nDetermines the type of search used for history entries. Available options:\n- `fuzzy` (default) - Uses a fuzzy search algorithm.\n- `substring` - Matches substrings exactly.\n- `exact` - Requires an exact match.\n\n### Enabled\n\nSet this to `false` to stop tracking the sites you have visited.\n\n```toml\n[history]\ntitle_color = \"rgb(137, 180, 250)\"\nurl_color = \"rgb(186, 194, 222)\"\ntime_color = \"rgb(242, 205, 205)\"\ntext_color = \"rgb(116, 199, 236)\"\nsearch_type = \"fuzzy\"\nenabled = false # Not currently tracking your history.\n```\n\n## ⌨️ Keybinding Settings\n\n### The `[keybindings]` section defines keyboard shortcuts for navigation in the UI.\n\n**Exit**\nThe key(s) used to exit the page view.\nExample: `q|ESC`\n\n**Next / Previous**\nKeys used to navigate forward and backward between pages.\nExample: `n|RIGHT`, `b|LEFT`\n\n**Down / Up**\nScroll down or up by one line.\nExample: `j|DOWN`, `k|UP`\n\n**Page Up / Page Down**\nScroll up or down by a page. The number of lines is configured in the `[display]` section.\nExample: `u+CTRL|PAGE_UP`, `d+CTRL|PAGE_DOWN`\n\n**Open in Browser**\nOpens the current item in the system's default browser.\nExample: `o`\n\nEach field accepts one or more key combinations separated by `|`. Combinations can use modifiers like `CTRL` or `ALT` with `+` (e.g., `o+CTRL`).\n\n```toml\n[keybindings]\nexit = \"q|ESC\"\nnext = \"n|RIGHT\"\nprevious = \"b|LEFT\"\ndown = \"j|DOWN\"\nup = \"k|UP\"\npage_up = \"u+CTRL|PAGE_UP\"\npage_down = \"d+CTRL|PAGE_DOWN\"\nopen_in_browser = \"o\"\n```\n\n## 🔍 Search Configuration\n\n### Engine\n\nDetermines which search engine is used when performing searches. Available options:\n\n- `duckduckgo` (default) - Uses DuckDuckGo for search queries.\n- `google` - Uses Google Custom Search. **Requires API configuration** (see below).\n- `kagi` - Uses Kagi Search. **Requires API configuration** (see below).\n\n### 📌 API Configuration for Google Search\n\nIf you choose `google` as your search engine, you must set up a Google Custom Search API. Follow these steps:\n\n1. Visit the [Google Custom Search API](https://developers.google.com/custom-search/v1/overview) page.\n2. Click **Get Started** and enable the API in your Google Cloud Console.\n3. Generate an **API Key** from the credentials section.\n4. Create a **Custom Search Engine** and obtain the **Search Engine ID**.\n5. Set the following environment variables:\n\n```sh\nexport IS_FAST_GOOGLE_API_KEY=\"your_api_key_here\"\nexport IS_FAST_GOOGLE_SEARCH_ENGINE_ID=\"your_search_engine_id_here\"\n```\n\nThese values must be provided for Google Search to function properly.\n\n### 📌 API Configuration for Kagi Search\n\nIf you choose `kagi` as your search engine, you must have access to the Kagi search API. Relevant documentation is [here](https://help.kagi.com/kagi/api/search.html).\n\nAfter obtaining access and your API key, set the following environment variable:\n```sh\nexport IS_FAST_KAGI_API_KEY=\"your_api_key_here\"\n```\n\n### Custom search engine\n\nIf you want to add your own custom search engine, please fork the repository and follow the instructions on [this file](src/search_engine/search_type.rs).\n\n\n```toml\n[search]\nengine = \"google\"\n```\n\n### Site\n\nIf you want to restrict your search only to a certain domain, setting this value will only show you search results from\nthat domain. This can be overridden by the `--site` argument.\n\n```toml\n[search]\nsite = \"en.wikipedia.org\"\n```\n\n### Timeout\n\nThis setting allows you to set the timeout in seconds before the tool will give up on a search or page.\n\n```toml\n[search]\ntimeout = 10\n```\n\n## 🔍 Selectors\n\n### Definition\n\nSelectors allow you to **extract only relevant content** from different websites. This is useful for customizing certain\nsites for a better user experience. If no selector is provided for a specific site then `body` will be used. Glob\nmatching is used to match the site, or even certain urls within the site to extract the most relevant text. NOTE: If\nthere are multiple globs that could match, the most restrictive should be placed higher in the config! Selectors are\nchosen from the first match only. Note that the CSS selectors defined here apply the full standard CSS selector logic,\nand are not limited to #id and .class only. This is in the tool configuration rather than the site configuration, because it is the most common reason that you would want to have a site specific configuration. This saves the user having to create a separate file for every case.\n\n```toml\n[selectors]\n\"*en.wikipedia.org*\" = \"p\"\n\"*github.com/*/blob/*\" = \".react-code-line-contents\" # Selectors will apply in this order\n\"*github.com*\" = \".markdown-body\"\n```\n\n### Effect\n\nWhen processing content from Wikipedia, only `\u003cp\u003e` elements will be extracted. For GitHub, if the url contains the\nendpoint blob it will return only elements with the CSS class .react-code-line-contents. Otherwise, it will return the\n.markdown-body.\n\n## ❓ Miscellaneous Settings\n\n### Open tool\n\nThis setting is unset by default, and controls the program that is used to open the page if you choose to open in browser. If unset this will be your default open tool. If you set this value it will execute the tool given to it. The tool must be available in your system to be able to run.\n\n### Text size supported\n\nEnabling this will allow text size to be shown when available. This is currently only supported for direct output to kitty terminal. If you are not running this code in kitty v0.40.0+ terminal, or you are using tmux, screen, zellij or another alternate screen then this will not work, and you should not turn it on. By default, this is false. If this is switched off, the text size configuration will have no impact on the output.\n\n\n```toml\n[misc]\nopen_tool = \"w3m\"\ntext_size_supported = false\n```\n\n## 📝 Custom Site Configuration\n\nThis allows you to add or change the site configuration, based on the site url. Using glob matches, it allows you to specify any number of additional configurations, which are then applied in order. In any case the configurations are conflicting, the last one in the list will be applied. The configurations are given as file names, which must be located in the same config directory as your config.toml.\n\n```toml\n[custom_config]\n\"*.example.com/*\" = [\"alternate_headers.toml\", \"alternate_color_scheme.toml\"]\n```\n\n---\n\n# Site Configuration\n\nSite configurations are set in the config.toml file to define the default behaviour for `is-fast`, but they can be updated with additional configurations in the custom config section of the tool configuration. This allows all of these configurations to be specified on a site by site basis.\n\n## 🏷 Block Elements\n\n### Definition\n\nBlock elements are HTML tags that should have **a new line before and after** them when processed. This helps preserve\nreadability and logical structure in the parsed content.\n\nBlock Elements support limited CSS selector features.\n\ndiv#center        will newline only divs that are marked center. \ndiv.this.that     will newline divs with the class this or the class that.\n.this.that        will newline any element with the class this OR the class that.\n#that             will newline any element with the id that.\ndiv#center.this   will newline any div with the id center OR the class this.\ndiv.this#center   is INVALID and will not work.\n.this#center      is INVALID and will not work.\n\nYou can specify if you want your configuration to override the existing tags, or just append to them.\n\n```toml\nblock_elements = [\n    \"p\", \"div\", \"article\", \"section\", \"pre\", \"blockquote\", \"ul\", \"ol\", \"dl\", \"dt\", \"dd\", \"li\",\n    \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"\n]\nclear_existing_block_tags = true\n```\n\n### Effect on Output\n\n#### Input HTML:\n\n```html\n\u003cp\u003eThis is a paragraph.\u003c/p\u003e\u003ch2\u003eTitle\u003c/h2\u003e\u003cul\u003e\u003cli\u003eItem 1\u003c/li\u003e\u003cli\u003eItem 2\u003c/li\u003e\u003c/ul\u003e\n```\n\n#### Output After Processing:\n\n```\nThis is a paragraph.\n\nTitle\n\n- Item 1\n- Item 2\n```\n\n## 🚫 Ignored Tags\n\n### Definition\n\nIgnored tags are HTML elements that **will be completely removed** from the processed content. These typically include *\n*scripts, metadata, and interactive elements** that are irrelevant to text processing.\n\nIgnored tags support the same limited CSS selector logic as block elements. See above for more information.\n\nYou can specify if you want your new config to replace or append to the default list. By default this will append.\n\n```toml\nignored_tags = [\n    \"script\", \"style\", \"noscript\", \"head\", \"title\", \"meta\", \"input\", \"button\", \"svg\", \"nav\", \"footer\", \"header\", \"aside\"\n]\nclear_existing_ignored_tags = false\n```\n\n### Effect on Output\n\n#### Input HTML:\n\n```html\n\u003chead\u003e\u003ctitle\u003eMy Page\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003e\n  \u003cp\u003eHello, world!\u003c/p\u003e\n  \u003cscript\u003ealert(\"Hello\");\u003c/script\u003e\n  \u003cfooter\u003e© 2025 My Website\u003c/footer\u003e\n\u003c/body\u003e\n```\n\n#### Output After Processing:\n\n```\nHello, world!\n```\n\n## ➡️ Indent Elements\n\nAll lines within these elements will be indented by 2 spaces (Note: on wrap the wrapped line will not be indented). Nested elements will be indented further.\n\nIndented tags support the same limited CSS selector logic as block elements. See above for more information.\n\nAs above, you can specify if you want this to replace the default tags, or just append to the existing tags.\n\n```toml\nindent_tags = [\n    \"li\"\n]\n# clear_existing_intent_tags = false -\u003e Defaults to false if not included.\n```\n\n### Effect on Output\n\n#### Input HTML:\n\n```html\n    \u003chtml\u003e\n        \u003cbody\u003e\n            \u003cspan\u003e Here is a list: \u003c/span\u003e\n            \u003col\u003e\n                \u003cli value=\"1\"\u003e\u003cspan\u003eThe Condition is evaluated:\u003c/span\u003e\n                    \u003col\u003e\n                        \u003cli value=\"1\"\u003e\u003cspan\u003eIf true, the control moves to Step 4.\u003c/span\u003e\u003c/li\u003e\n                        \u003cli value=\"2\"\u003e\u003cspan\u003eIf false, the control jumps to Step 7.\u003c/span\u003e\u003c/li\u003e\n                    \u003c/ol\u003e\n                \u003c/li\u003e\n                \u003cli value=\"2\"\u003e\u003cspan\u003eThe body of the loop is executed.\u003c/span\u003e\u003c/li\u003e\n            \u003c/ol\u003e\n        \u003c/body\u003e\n    \u003c/html\u003e\n```\n\n#### Output After Processing:\n\n```\nHere is a list:\n  1. The condition is evaluated:\n    1. If true, the control moves to Step 4.\n    2. If false, the control jumps to Step 7.\n  2 The body of the loop is executed.\n```\n\n## 🎨 Text Styles\n\n### Definition\n\nThis section defines **how different HTML tags should be styled** in the output. Colors can be specified using standard color names (e.g., red, blue), hex values (e.g., #ff5733), or RGB notation (e.g., rgb(255, 87, 51)). Css selectors will be applied as above. Styles will be combined when they match multiple cases. Standard ansi escape codes (e.g. bold, underlined) can all be added.\n\n#### Kitty text size protocol\n\nSize is supported through the kitty text size protocol. This will currently only work with the kitty terminal version 0.40.0+. It will not work if you are running tmux, screen ect. It will only show the size when directly printed to terminal, not through the tui. This feature is very new, so availability in other terminals will depend on uptake.\n\nValid values for size are `normal` (to reset size in a nested element), `double`, `triple` and `half`.\nThe first letter is not case-sensitive.\nAs an alternative the values 1, 2 or 3 can also be used for normal, double and triple.\n\nThis feature needs to be specifically switched on in the misc section.\n\n```toml\n[styles.h1]\nbold = true\n\n[styles.a]\nfg = \"Cyan\"\n\n[styles.blockquote]\nfg = \"Gray\"\nitalic = true\nsize = \"Double\"\n```\n\nThis means:\n\n- `\u003ch1\u003e` will be **bold**.\n- `\u003ca\u003e` (links) will be **cyan**.\n- `\u003cblockquote\u003e` will be **gray** and **italicised**.\n\n### Style Precedence and Merging\n\nStyles are cumulative and follow a priority order. The precedence for matching styles is:\n\n- Basic (default) style – applies when no specific match exists.\n- Tag selector – applies to all elements of a given type (e.g., div).\n- Untagged class selector – applies to all elements with the class (e.g., .that).\n- Tagged class selector – applies to a specific tag with the class (e.g., div.that).\n- Untagged ID selector – applies to the element with a specific ID (e.g., #this).\n- Tagged ID selector – applies to a specific tag with a specific ID (e.g., div#this).\n\n## 🌈 Syntax Highlighting\n\nThe `[syntax]` section defines syntax highlighting settings for code. Where possible the language type will be\ndetermined from the CSS classes present in the HTML.\n\n### Default Language\n\nThis defines the language that is used if the language type cannot be determined from the CSS classes. This should be\nset to your primary development language.\n\n### Theme\n\nThis sets the theme that should be used. Valid themes are:\n\n```\nInspiredGitHub\nSolarized (dark)\nSolarized (light)\nbase16-eighties.dark\nbase16-mocha.dark\nbase16-ocean.dark\nbase16-ocean.light\n```\n\n```toml\n[syntax]\ndefault_language = \"rust\"\ntheme = \"base16-ocean.dark\"\n```\n\n## 🗄️ Cache Settings\n\nCaching stores the raw HTML associated with a URL, allowing for faster retrieval of previously accessed results. This is particularly useful for scripts where you may need to select multiple elements from the same page by repeatedly calling the search function with different selectors.\n### Configuration Options\n\n### `cache_mode`\n- **Description**: Determines the caching mode. Caching is disabled by default.\n- **Options**:\n  - `disabled`: No caching is performed.\n  - `read`: Only reads from the cache; does not write new entries.\n  - `write`: Only writes to the cache; does not read from it.\n  - `readwrite`: Both reads from and writes to the cache.\n\n  This can be overriden with the `--cache`, `--no-cache`, `--cache-mode` or `--flash-cache` flags.\n\n### `max_size`\n- **Description**: Specifies the maximum size of the cache. During testing, it was observed that approximately 2MB is used per 100 entries, though this may vary depending on the size of the pages being cached.\n- **Type**: Integer\n- **Default**: `100`\n\n### `ttl` (Time to Live)\n- **Description**: Defines how long the cached value should remain valid, in seconds. Note that the cached data is stored with the TTL being added to the cached time. This means that if you change this to a longer value and then change it back, the longer-lived data might persist. To remove such data, use the `--clear-cache` flag.\n- **Type**: Integer\n- **Default**: `300` (5 minutes)\n\n```toml\n[cache]\ncache_mode = \"readwrite\"\nmax_size = 100\nttl = 300\n```\n\nNote that the `--flash-cache` flag overrides this config setting readwrite mode, infinite max size and a ttl of 5 seconds while it is applied.\n\n## 🛂 Headers\n\nThis section allows you to define the headers that will be added when you make the request.\n\n```toml\n[headers]\n\"Accept\" = \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\"\n\"Accept-Language\" = \"en-US,en;q=0.9\"\n\"User-Agent\" = \"Lynx/2.8.8dev.3 libwww-FM/2.14 SSL-MM/1.4.1\"\n```\n\n# 🌍 Environment Variables\n\nCertain functionality in `is-fast` can be customized via environment variables. Below are the key environment variables you can configure:\n\n## Directory Configuration\n| Variable Name          | Description                                              |\n|------------------------|----------------------------------------------------------|\n| `IS_FAST_CONFIG_DIR`   | Full path where the configuration file should be stored. |\n| `IS_FAST_DATABASE_DIR` | Full path where the database file should be stored.      |\n| `IS_FAST_LOG_DIR`      | Full path where log files should be stored.              |\n\n**Note:** These paths must be absolute and cannot be relative to the home directory.\n\n## Search API Configuration\nIf you plan to use external search engines, you must configure the respective API keys. [See the search engine configuration section above for more details](#engine).\n\n| Environment Variable              | Description                                         |\n|-----------------------------------|-----------------------------------------------------|\n| `IS_FAST_GOOGLE_API_KEY`          | API key for Google Custom Search.                   |\n| `IS_FAST_GOOGLE_SEARCH_ENGINE_ID` | Search Engine ID for Google Custom Search.          |\n| `IS_FAST_KAGI_API_KEY`            | API key for Kagi search (currently in closed Beta). |\n\n# 🌐 Using `is-fast` to Open URLs Directly\n\n`is-fast` allows you to open a specific URL directly in its terminal viewer, bypassing the search functionality. This is\ndone using the `--direct` option.\n\n### `--direct` / `-d`\n\n**Open a given URL directly in the TUI viewer.**\n\nIf this option is provided, `is-fast` will immediately load and render the contents of the given URL inside the terminal\ninterface.\n\n```sh\nis-fast --direct \"https://example.com\"\nis-fast -d https://example.com\n```\n\n---\n\n# 📃 Using `is-fast` with Local HTML Files\n\n`is-fast` also supports rendering local HTML files inside its terminal viewer. This is done using the `--file` option.\nAdditionally, you can associate the file with a reference URL using the `--url` option.\n\n### `--file` / `-f`\n\n**View a local HTML file instead of performing an internet search.**\n\nIf this option is provided, `is-fast` will render the given HTML file inside its terminal viewer instead of fetching\nsearch results from the internet.\n\n```sh\nis-fast --file example.html\nis-fast -f example.html\n```\n\n### `--url` / `-u`\n\n**Associate the HTML file with a reference URL.**\n\nThis option is only valid when `--file` is used. It allows you to provide a URL that will be used for informing which\nselector should be used with this file.\n\n```sh\nis-fast --file example.html --url example.com\nis-fast -f example.html -u example.com\n```\n\n---\n\n# 🔄 Using `--piped`, `|` or `\u003e` to Output to Standard Output\n\nInstead of rendering the content inside the TUI viewer, `is-fast` provides an option to output the processed result\ndirectly to **standard output (stdout)**. This allows you to **pipe the output** to other commands or **write it to a\nfile**. This can be directly invoked using the `--piped` command in the case that you just want to print to stdout, or \nadded implicitly in the case that the output is not the terminal. The result is in plain text unless `--color=always` \nis applied, but otherwise with the formatting you would see in the TUI.\n\n## Output type\n\n### Search command\n\nWhen used with a regular search, the first search result will be sent out.\n\n### `--direct` or `--file`\n\nThe contents of the page will be output.\n\n### `--history`\n\nThe history database will be output in CSV format. If you want to further manipulate/query this data, I recommend \n[mlr](https://github.com/johnkerl/miller) for processing it. If you are more comfortable with json processing, using `mlr`\nyou can easily convert to json to be processed by [jq](https://github.com/jqlang/jq).\n\nHere is how you could get a list of all the titles this way.\n\n```sh\nis-fast --history | mlr --icsv --ojson cat | jq '.[].title'\n```\n\n#### Other Uses:\n\n```sh\n# Output the contents of a local file to stdout\nis-fast --file example.html --piped\n\n# Fetch and output the contents of a URL to stdout\nis-fast --direct \"https://example.com\" --piped\n\n# Save the output to a file\nis-fast --file example.html \u003e output.txt\n\n# Pipe the output into another command\nis-fast --direct \"https://example.com\" | grep \"keyword\"\n```\n\nUsing `--piped` makes `is-fast` behave more like a **command-line utility** for extracting and processing content,\nrather than an interactive TUI viewer.\n\n---\n\n# 📜 Viewing History in `is-fast`\n\n`is-fast` allows you to view and select previously visited pages using the `--history` option.\n\n### `--history`\n\n**Show previously viewed pages.**\n\nIf this option is provided, `is-fast` will display a list of previously visited webpages, numbered with the most recent entries at the bottom. You can scroll up and down and select to open. The entries are stored locally in a SQLite database. If you don't wish for your sites to be tracked, then you can switch this feature off in the Configuration. The argument will still show your current history, but new searches will not add to your history. You can delete from your history by using the delete key in the history view, or by running the command `--clear-history`.\n\n```sh\nis-fast --history\n```\n\n### `--last`\n\nThis will show the last page from your history. History must be enabled and have entries for this flag to work. This is very useful for scripts where a search is involved, as search resuts are non deterministic, so repeating with the same search might lead you to have *different results*.\n\n#### Example Usage in a script:\n\n```sh\nisf_so() {\n    QUESTION=$(is-fast ${*} --site \"www.stackoverflow.com\" --selector \"div.question .js-post-body\" --color=always --flash-cache --piped) # Find the question content.\n    ANSWER=$(is-fast --last --selector \"div.accepted-answer .js-post-body\" --color=always --flash-cache --piped) # Separately find the answer content, using last to ensure the same result is shown.\n    cat \u003c\u003c EOF # Format as desired\nQUESTION:\n\n$QUESTION\n\nANSWER:\n\n$ANSWER\nEOF\n}\n```\n\n### `--no-history`\n\nWhen this flag is used with a search command will not log history for that request.\n\n```sh\nis-fast --no-history \"how to deal with an obnoxious boss\"\n```\n\n---\n\n# ⚡ Caching in `is-fast`\n\n`is-fast` includes an optional caching system to speed up the loading of static pages when revisiting them. By default, caching is disabled, but you can enable it and configure its behavior. The default behaviour of the cache when enabled is to have a TTL of 5 minutes, and a max cache size of 1000. When testing the average size of 1000 results was around 23MB, but this will vary depending on the size of the html you are processing.\n\nAs the vast majority of the time is-fast spends is waiting for the results of the webscraping to be returned, when a cache hit occurs the result is basically instant. This is very useful if you are reading a little, closing the program, making some changes, then coming back to the same result.\n\nNote, if the provided flag conflicts with the config, the flag will always take priority. If multiple flags are provided, then is-fast will fail safe to disabled.\n\n### `--cache`\n\nThis will cache the result even if caching is normally disabled.\n\n```sh\nis-fast --cache \"Java how to use entity manager\"\n```\n\n### `--no-cache`\n\nThis will not cache the result even if caching is normally enabled.\n\n```sh\nis-fast --no-cache --direct \"www.football.com/live/game\" --selector \"div.scores\"\n```\n\n### `--flash-cache`\n\nThis uses a special mode where the cache size is maximum for the duration of the request, but the TTL is only 5 seconds. This is useful for scripting, where you want temporary caching without filling your cache.\n\n```sh\nisf_find() {\n    local index=1\n    local element\n    \n    while :; do\n        element=$(is-fast --direct \"en.wikipedia.org/wiki/rome\" --selector \"div.mw-content-ltr \u003e p\" --nth-element \"$index\" --color=always --flash-cache --piped)\n        \n        # Break if the element is empty - means all elements have been searched.\n        if [[ -z \"$element\" ]]; then\n            break\n        fi\n        \n        # If the element contains \"given word\", print and exit\n        if echo \"$element\" | grep -qi \"$1\"; then\n            echo \"$element\"\n            return\n        fi\n        \n        ((index++))\n    done\n}\n```\n\n### `--cache-mode`\n\nAllows you to explicitly set the cache mode. Available options are `readwrite`, `read`, `write`, `never`, and `flash`.\n\nThe write mode is useful if you have a bad cached value stored, as it will override the bad value with the newer one.\n\n```sh\nis-fast --cache-mode write --direct \"www.previously_bad_result.com\"\n```\n---\n\n## 🐞 Logging in `is-fast`\n\n`is-fast` includes an optional logging system to help you debug or monitor the tool's behavior. Logs are written to a file, which by default will be placed inside your config directory. You can override this location by setting the `IS_FAST_LOG_DIR` environment variable.\n\nThe logging system is based on Rust's standard logging framework, which is normally controlled through the `RUST_LOG` environment variable. Internally, enabling `--log` has the same effect as setting `RUST_LOG=is_fast=error`. If you want to enable more detailed logging for external crates as well, using the `RUST_LOG` environment variable is recommended.\n\nExample of using `RUST_LOG` to enable verbose logging across crates:\n\n```sh\nRUST_LOG=\"is_fast=debug,ureq=info\" is-fast \"How to do rust logging\"\n```\n\n### `--log`\n\nEnables logging with a default log level of `error`.\n\n```sh\nis-fast --log \"Java how to use entity manager\"\n```\n\n### `--log-level`\n\nSets the specific log level to use. Available options typically include `error`, `warn`, `info`, `debug`, and `trace`.\n\n```sh\nis-fast --log --log-level debug \"Debug level rust logging\"\n```\n\n---\n\n# 🔑 Customizing your results\n\n### `--selector/-s`\n\nApply the given CSS selector to the page. This will only apply to --file and --direct queries.\n\n```sh\nis-fast --selector \".interesting\" --direct \"www.site.com\"\n```\n\n### `--nth-element`\n\nNormally used in conjunction with `--selector` this allows you to only return the nth element that matches that selector. Multiple options can be provided, either comma separated or flag separated.\n\n```sh\n    is-fast --direct \"www.example.com/site\" --selector \"div.sb\" --nth-element 1,2 --nth-element 4 # There are multiple div.sb elements - we only want to see the first, second and fourth.\n```\n\n### `--site`\n\nThis will restrict the search to only the given domain.\n\n```sh\nis-fast --site \"en.wikipedia.org\" \"Rust programming language\"\n```\n\n### `--color`\n\nThis allows the caller to specify the color mode. Default value is `tui`, which will only show color in the TUI mode. However it can also be set to `never` and `always`\n\n```sh\nis-fast --color=always \"How to do a for loop in rust\" | bat # Will output to bat with full colors\n```\n### `--ignore`\n\nThis allows the user to specify additional elements to ignore. These follow the same limited css selector logic as in the configuration file. This takes a list value, either from multiple flags or comma separated.\n\n```sh\nis-fast --last --ignore=\"div.sidebar,div#ignore\" --ignore=\".bad-vibes\"\n```\n\n### `--style-element`\n\nThis flag allows users to apply inline styles to specific elements in the output.\n\n**Format:**  \n```\n--style-element=\"tag#id.class.otherclass:fg=red;bg=green;bold\"\n```\n- The selector (`tag#id.class.otherclass`) determines which elements the style applies to.\n- The style rules (`fg=red;bg=green;bold`) define the appearance of the element.\n- Boolean attributes (like `bold`) default to `true` if no value is provided (`bold=true` is a valid alternative).\n\n**Usage Examples:**  \n```sh\nis-fast --style-element=\"h1.title:fg=blue;bold\" --style-element=\"p:fg=gray\"\n```\nThis will:\n- Style `\u003ch1 class=\"title\"\u003e` elements with blue foreground and bold text.\n- Style `\u003cp\u003e` elements with a gray foreground.\n\nYou can specify multiple `--style-element` flags to apply different styles to different elements. This provides fine-grained control over text appearance in the output.\n\n\n### `--no-block`\n\nWhen this flag is applied block elements are ignored. This is useful if you want to get a small amount of information but it ends up being\nunexpectedly on different lines.\n\n```sh\nis-fast --last --no-block\n```\n\n### `--pretty-print`\n\nCustomize the format of the output to the terminal with the following commands. This flag does not affect the TUI and would normally be use in conjunction with the `--piped` command:\n\n- **`wrap`**: This will automatically wrap the output.\n  ```sh\n  is-fast --pretty-print=\"wrap\" \"Some search term\"\n  ```\n\n- **`margin:\u003cvalue\u003e`**: This will apply a margin to the output. If a margin is applied, it will also automatically wrap the output. The value should be a number indicating the desired margin in characters.\n  ```sh\n  is-fast --pretty-print=\"margin:10\" \"Some search term\"\n  ```\n\n- **`title:Option(\u003cvalue\u003e)`**: This will apply a title to the output. Note that the title cannot contain the characters `,` or `:` due to parsing issues. If the title value is not provided then the title of the page will be used instead.\n  ```sh\n  is-fast --pretty-print=\"title:My Custom Title\" \"Some search term\"\n  ```\n\n- **Combining commands**: You can combine the different commands to apply multiple customizations at once.\n  ```sh\n  is-fast --pretty-print=\"wrap,margin:10,title:Search Results\" \"Some search term\"\n  ```\n\n### Example usage of `--pretty-print`:\n\n- Apply wrapping with a margin of 10 and a custom title:\n  ```sh\n  is-fast --pretty-print=\"wrap,margin:10,title:Rust Programming\" \"Rust programming language\"\n  ```\n\n- Apply a title without wrapping:\n  ```sh\n  is-fast --pretty-print=\"title:Rust Info\" \"Rust programming language\"\n  ```\n\n- Apply wrapping alone:\n  ```sh\n  is-fast --pretty-print=\"wrap\" \"Rust programming language\"\n  ```\n\n- Apply margin and wrapping together:\n  ```sh\n  is-fast --pretty-print=\"margin:15\" \"Rust programming language\"\n  ```\n\n---\n\n# 🧹 Clearing Data\n\nTo remove stored history or cached pages, use the following options:\n\n- `--clear-history` clears all stored history.\n- `--clear-cache` clears all cached pages.\n- `--clear-all` clears both cache and history.\n\n```sh\nis-fast --clear-history\nis-fast --clear-cache\nis-fast --clear-all\n```\n\n---\n\n# Example scripts\n\nPlease see the [scripts](scripts) folder for some fun little functions that show how `is-fast` can be be used in a powerful and flexible way as a cli utility for retrieving information from the web.\n\n## Contributors\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"http://pwnwriter.me\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/90331517?v=4?s=100\" width=\"100px;\" alt=\"Nabeen Tiwaree\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNabeen Tiwaree\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#platform-pwnwriter\" title=\"Packaging/porting to new platform\"\u003e📦\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/rehanzo\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/60243794?v=4?s=100\" width=\"100px;\" alt=\"Rehan\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRehan\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#plugin-rehanzo\" title=\"Plugin/utility libraries\"\u003e🔌\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/d3-X-t3r\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1624052?v=4?s=100\" width=\"100px;\" alt=\"d3Xt3r\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ed3Xt3r\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#ideas-d3-X-t3r\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMagic-JD%2Fis-fast","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMagic-JD%2Fis-fast","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMagic-JD%2Fis-fast/lists"}