Skip to content

smokingplaya/uki

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shi

uki

uki is a utility for running predefined commands in various shells on your system through a simple YAML configuration. It allows you to customize commands for frequent use and run them through a single call.

Installing

  • Linux
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/smokingplaya/uki/HEAD/misc/install.sh)"
  • Windows (powershell with admin rights)
    & {Invoke-WebRequest -Uri "https://raw.githubusercontent.com/smokingplaya/uki/refs/heads/master/misc/windows.ps1" -OutFile "$env:USERPROFILE\Downloads\install_uki.ps1"; & "$env:USERPROFILE\Downloads\install_uki.ps1"}

Using

uki <preset> <arguments>
  • preset is the name of the preset (a set of pre-prepared commands) to be run. If you do not specify a preset, the default preset will be used by default.
  • arguments are the parameters that are passed to the preset commands.

Examples:

  1. Run the default preset (no arguments):
    uki
  2. Run the example preset with the argument “hello, there”:
    uki example "hello, there"
  3. Run the default preset with arguments passed:
    uki default arg1 arg2

Configuration

For uki to work, there must be a YAML configuration file called .uki in the current directory.

Example of .uki file structure:

default-enviroment: bash # Default shell for all presets (optional)
default-preset: default # Default preset if not specified (optional)

# Presets section (required)
presets:
  # Preset name
  default:
    enviroment: bash        # Shell override for a specific preset (optional)
    description: "Пресет, который ничего не делает"  # Preset description (optional)
    arguments:
      - name: arg1          # Name of the argument
        default: ""         # Default value for the argument (optional)
    commands:               # Command list (required)
      - echo "${arg1}"      # Example of a command using the argument

Supported shells:

  • bash
  • zsh
  • powershell
  • cmd

Description of configuration parameters:

  • default-enviroment - specifies the default shell for all presets. If not specified, the system-installed shell will be used for the preset.

  • default-preset - specifies the preset that will be run if the first argument (preset name) was not passed when uki was called.

  • presets - mandatory section where all presets are described. Each preset can contain the following parameters:

    • enviroment - the shell in which the commands of this preset will be executed.
    • description - description of the preset to make it clear what it does.
    • arguments - list of arguments that can be passed to the preset.
    • commands - list of commands that will be executed when the preset is started. Arguments passed through the CLI can be used in commands using the ${arg} syntax.

Example of preset usage:

presets:
  example:
    enviroment: zsh
    description: "Example of preset"
    arguments:
      - name: message
        default: "Hello, world!"
    commands:
      - echo "${message}"

If you execute the command:

uki example “What's up”

Then uki will start the example preset by passing the “What's up” argument to the command, and execute the echo “What's up” command in the zsh shell.

Building

To build uki, follow these steps:

git clone https://github.com/smokingplaya/uki
cargo build --release
cd target/release

Support and Contributions

We are always open to improvements! If you have ideas, comments, or fixes, feel free to open a pull request.