diff --git a/README.md b/README.md index d663a76..9bdb8de 100644 --- a/README.md +++ b/README.md @@ -104,13 +104,13 @@ workflow, making your experience more enjoyable and productive. ### Cargo -```shell +```sh cargo install tinty ``` ### Homebrew -```shell +```sh brew tap tinted-theming/tinted brew install tinty ``` @@ -121,7 +121,7 @@ Download the relevant binary from the [repository releases] page. ### Manual -```shell +```sh git clone https://github.com/tinted-theming/tinty path/to/tinty cd path/to/tinty make install @@ -134,20 +134,20 @@ cp target/release/tinty /path/to/bin/dir For the most basic usage without configuration, install Tinty and run the following to apply `base16-mocha`: -```shell +```sh tinty install # Required once or when your config file is updated tinty apply base16-mocha ``` To get a list of [schemes] and more information about the colors: -```shell +```sh tinty list tinty info base16-oceanicnext ``` -Without any `config.toml` file, `tinty` will apply your shell theme using -[base16-shell] using `sh` shell. +Without any `config.toml` file, `tinty` will apply your shell theme +using [tinted-shell] using `sh` shell. ## Usage @@ -217,14 +217,14 @@ specify templates, directories for theme files, and hooks for applying themes. Configuring items effectively enables you to manage multiple themes across different applications seamlessly. -| Key | Type | Required | Description | Default | Example | -|-----------------------|----------|----------|---------------------------------------------------------------|---------|--------------------------------------------| -| `name` | `string` | Required | A unique name for the item being configured. | - | `name = "vim"` | -| `path` | `string` | Required | The file system path or URL to the theme template repository. Paths beginning with `~/` map to home dir. | - | `path = "https://github.com/base16-vim"` | -| `themes-dir` | `string` | Required | The directory within the repository where theme files are located. | - | `themes-dir = "colors"` | -| `hook` | `string` | Optional | A command to be executed after the theme is applied. Useful for reloading configurations. `%f` template variable maps to the path of the applied theme file. | None | `hook = "source ~/.vimrc"` | +| Key | Type | Required | Description | Default | Example | +|------------------------|----------|----------|---------------------------------------------------------------|---------|--------------------------------------------| +| `name` | `string` | Required | A unique name for the item being configured. | - | `name = "vim"` | +| `path` | `string` | Required | The file system path or URL to the theme template repository. Paths beginning with `~/` map to home dir. | - | `path = "https://github.com/tinted-tmux"` | +| `themes-dir` | `string` | Required | The directory within the repository where theme files are located. | - | `themes-dir = "colors"` | +| `hook` | `string` | Optional | A command to be executed after the theme is applied. Useful for reloading configurations. `%f` template variable maps to the path of the applied theme file. | None | `hook = "source ~/.vimrc"` | | `theme-file-extension` | `string` | Optional | Define a custom theme file extension that isn't `/\.*$/`. Tinty looks for themes named `base16-uwunicorn.*` (for example), but when the theme file isn't structured that way, this option can help specify the pattern. | - | `theme-file-extension = ".module.css"` | -| `supported-systems` | `array<"base16" or "base24">` | Optional | Defines which theming systems ("base16" and or "base24") are supported by the item. | `["base16"]` | `supported-systems = ["base16", "base24"]` | +| `supported-systems` | `array<"base16" or "base24">` | Optional | Defines which theming systems ("base16" and or "base24") are supported by the item. | `["base16"]` | `supported-systems = ["base16", "base24"]` | #### Note on `supported-systems` @@ -250,31 +250,32 @@ default-scheme = "base16-mocha" # Item configurations [[items]] -name = "vim" -path = "https://github.com/tinted-theming/base16-shell" +name = "tinted-shell" +path = "https://github.com/tinted-theming/tinted-shell" themes-dir = "scripts" hook = "source %f" +supported-systems = ["base16", "base24"] [[items]] -name = "vim" +name = "base16-vim" path = "https://github.com/tinted-theming/base16-vim" themes-dir = "colors" -hook = "source ~/.vimrc" supported-systems = ["base16"] +# Look at USAGE.md for more information on sourcing the generated file in vim [[items]] name = "tmux" path = "~/path/path/to/base16-tmux" themes-dir = "colors" -hook = "tmux source-file ~/.tmux.conf" -supported-systems = ["base16"] +hook = "tmux run 2> /dev/null && tmux source-file %f" +supported-systems = ["base16", "base24"] ``` ### Select and apply a scheme using fzf Note: Requires [fzf] -```shell +```sh tinty apply $(tinty list | fzf) ``` @@ -328,8 +329,8 @@ light = false ```toml # ~/.config/tinted-theming/tinty/config.toml [[items]] -path = "https://github.com/aarowill/base16-alacritty" -name = "base16-alacritty" +path = "https://github.com/tinted-theming/tinted-alacritty" +name = "tinted-alacritty" themes-dir = "colors" hook = "cp -f %f ~/.config/alacritty/colors.toml" @@ -385,7 +386,7 @@ file for details. [Base16 builder specification]: https://github.com/tinted-theming/home/blob/main/builder.md [home repository]: https://github.com/tinted-theming/home [Base16 Gallery]: https://tinted-theming.github.io/base16-gallery -[base16-shell]: https://github.com/tinted-theming/base16-shell +[tinted-shell]: https://github.com/tinted-theming/tinted-shell [schemes]: https://github.com/tinted-theming/schemes [fzf]: https://github.com/junegunn/fzf [Base16]: https://github.com/tinted-theming/home/blob/main/styling.md diff --git a/example.toml b/example.toml index aba6f91..93bc322 100644 --- a/example.toml +++ b/example.toml @@ -22,9 +22,9 @@ # [[items]] # # Path to template repository. Can be a URL, absolute path or path # # beginning with `~/`. -# path = "https://github.com/tinted-theming/base16-shell" +# path = "https://github.com/tinted-theming/tinted-shell" # # Unique name of item -# name = "base16-shell" +# name = "tinted-shell" # # Name of the repository directory containing the theme files # themes-dir = "scripts" # # (Optional) Command to execute after copying template (goes through `shell`) @@ -41,8 +41,8 @@ # default-scheme = "base16-oceanicnext" # # [[items]] -# path = "https://github.com/tinted-theming/base16-shell" -# name = "base16-shell" +# path = "https://github.com/tinted-theming/tinted-shell" +# name = "tinted-shell" # hook = ". %f" # themes-dir = "scripts" # diff --git a/src/config.rs b/src/config.rs index 2319c92..7d1d0a5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,8 +10,8 @@ use url::Url; pub const DEFAULT_CONFIG_SHELL: &str = "sh -c '{}'"; pub const CONFIG_FILE_NAME: &str = "config.toml"; -pub const BASE16_SHELL_REPO_URL: &str = "https://github.com/tinted-theming/base16-shell"; -pub const BASE16_SHELL_REPO_NAME: &str = "base16-shell"; +pub const BASE16_SHELL_REPO_URL: &str = "https://github.com/tinted-theming/tinted-shell"; +pub const BASE16_SHELL_REPO_NAME: &str = "tinted-shell"; pub const BASE16_SHELL_THEMES_DIR: &str = "scripts"; pub const BASE16_SHELL_HOOK: &str = ". %f"; diff --git a/src/operations/apply.rs b/src/operations/apply.rs index 626d05c..5ce2d6a 100644 --- a/src/operations/apply.rs +++ b/src/operations/apply.rs @@ -187,7 +187,7 @@ pub fn apply( } } - // Run global hooks + // Run global tinty/config.toml hooks if let Some(hooks_vec) = config.hooks.clone() { for hook in hooks_vec.iter() { let hook_command_vec = get_shell_command_from_string(config_path, hook.as_str())?; diff --git a/src/operations/config.rs b/src/operations/config.rs index f42bb10..55b24fb 100644 --- a/src/operations/config.rs +++ b/src/operations/config.rs @@ -23,7 +23,7 @@ pub fn config( println!("{config}"); } (true, true) => { - // This case should be dealt with by clap + // This case should already be handled by clap return Err(anyhow!( "the argument '--data-dir-path' cannot be used with '--config-path'", )); diff --git a/src/operations/list.rs b/src/operations/list.rs index 10b3fbe..188d8d1 100644 --- a/src/operations/list.rs +++ b/src/operations/list.rs @@ -8,7 +8,7 @@ use std::path::Path; /// Lists available color schemes /// /// Lists colorschemes file which is updated via scripts/install by getting a list of schemes -/// available in https://github.com/tinted-theming/schemes/base16 +/// available in https://github.com/tinted-theming/schemes pub fn list(data_path: &Path, is_custom: bool) -> Result<()> { let schemes_dir_path = if is_custom { data_path.join(CUSTOM_SCHEMES_DIR_NAME) diff --git a/tests/cli_apply_subcommand_tests.rs b/tests/cli_apply_subcommand_tests.rs index 7ef901e..399fac4 100644 --- a/tests/cli_apply_subcommand_tests.rs +++ b/tests/cli_apply_subcommand_tests.rs @@ -18,7 +18,7 @@ fn test_cli_apply_subcommand_with_setup() -> Result<()> { "test_cli_apply_subcommand_with_setup", format!("apply {}", &scheme_name).as_str(), )?; - let shell_theme_filename = "base16-shell-scripts-file.sh"; + let shell_theme_filename = "tinted-shell-scripts-file.sh"; let current_scheme_path = data_path.join(CURRENT_SCHEME_FILE_NAME); // --- @@ -182,7 +182,7 @@ hooks = ["echo 'Path: %f'"] let custom_scheme_file_path = data_path.join(format!("custom-schemes/base16/{}.yaml", scheme_name)); let expected_output = format!( - r#"Successfully generated "base16" themes for "base16" at "{}/repos/base16-shell/scripts/*.sh"#, + r#"Successfully generated "base16" themes for "base16" at "{}/repos/tinted-shell/scripts/*.sh"#, data_path.display() ); let current_scheme_path = data_path.join(CURRENT_SCHEME_FILE_NAME); @@ -228,9 +228,8 @@ fn test_cli_apply_subcommand_root_hooks_with_setup() -> Result<()> { format!("apply {}", &scheme_name).as_str(), )?; let expected_output = "This\nis\nexpected\noutput."; - let config_content = r##" -hooks = ["echo 'This '", "echo 'is '", "echo 'expected '", "echo 'output.'"] -"##; + let config_content = + r#"hooks = ["echo 'This'", "echo 'is'", "echo 'expected'", "echo 'output.'"]"#; write_to_file(&config_path, config_content)?; // --- diff --git a/tests/cli_config_subcommand_tests.rs b/tests/cli_config_subcommand_tests.rs index f4b650a..c844cfe 100644 --- a/tests/cli_config_subcommand_tests.rs +++ b/tests/cli_config_subcommand_tests.rs @@ -11,8 +11,8 @@ fn test_cli_config_without_config() -> Result<()> { let expected = r#"shell = "sh -c '{}'" [[items]] -name = "base16-shell" -path = "https://github.com/tinted-theming/base16-shell" +name = "tinted-shell" +path = "https://github.com/tinted-theming/tinted-shell" hook = ". %f" supported-systems = ["base16"] themes-dir = "scripts" diff --git a/tests/cli_general_tests.rs b/tests/cli_general_tests.rs index b0c4865..d773c3b 100644 --- a/tests/cli_general_tests.rs +++ b/tests/cli_general_tests.rs @@ -134,7 +134,7 @@ fn test_cli_default_data_path() -> Result<()> { // ------ fs::remove_file(&config_path)?; // cleanup assert!( - data_path.join("repos/base16-shell").exists(), + data_path.join("repos/tinted-shell").exists(), "stdout does not contain the expected output" ); assert_eq!( @@ -182,7 +182,7 @@ fn test_cli_data_path_tilde_as_home() -> Result<()> { // Assert // ------ assert!( - data_path.join("repos/base16-shell").exists(), + data_path.join("repos/tinted-shell").exists(), "stdout does not contain the expected output" ); assert!( diff --git a/tests/cli_install_subcommand_tests.rs b/tests/cli_install_subcommand_tests.rs index 75e7c66..dce49c7 100644 --- a/tests/cli_install_subcommand_tests.rs +++ b/tests/cli_install_subcommand_tests.rs @@ -82,7 +82,7 @@ fn test_cli_install_subcommand_without_setup() -> Result<()> { // ------- let (_, _, command_vec, cleanup) = setup("test_cli_install_subcommand_without_setup", "install")?; - let expected_output = "base16-shell installed"; + let expected_output = "tinted-shell installed"; // --- // Act @@ -107,7 +107,7 @@ fn test_cli_install_subcommand_with_setup() -> Result<()> { // Arrange // ------- let (_, _, command_vec, cleanup) = setup("test_cli_install_subcommand_with_setup", "install")?; - let expected_output = "base16-shell already installed"; + let expected_output = "tinted-shell already installed"; // --- // Act diff --git a/tests/cli_update_subcommand_tests.rs b/tests/cli_update_subcommand_tests.rs index 5cb74cf..9445fc9 100644 --- a/tests/cli_update_subcommand_tests.rs +++ b/tests/cli_update_subcommand_tests.rs @@ -12,7 +12,7 @@ fn test_cli_update_subcommand_without_setup() -> Result<()> { "test_cli_install_subcommand_non_unique_config_item_name", "update", )?; - let expected_output = format!("base16-shell not installed (run `{} install`)", REPO_NAME); + let expected_output = format!("tinted-shell not installed (run `{} install`)", REPO_NAME); // --- // Act @@ -38,7 +38,7 @@ fn test_cli_update_subcommand_with_setup() -> Result<()> { // ------- let (config_path, data_path, command_vec, cleanup) = setup("test_cli_update_subcommand_with_setup", "update")?; - let expected_output = "base16-shell up to date"; + let expected_output = "tinted-shell up to date"; // --- // Act