mk

command module
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 2 Imported by: 0

README

mk - Interactive Task Runner for Makefile (Taskfile)

Go Report Card GitHub release GitHub license

mk is a command-line interface (CLI) tool designed to interactively execute make commands from a Makefile (GNU Make) or tasks from a Taskfile.yml go-task. It provides a user-friendly interface to select and run predefined commands, making it easier to manage and execute build tasks.

mk

Features

  • Interactive Interface: Browse and select from available make commands using arrow keys or filter by typing.
  • Documentation: View the description of each command to understand its purpose and usage.
  • Vim like keybindings: Use j and k to navigate, Enter to execute, and q to quit.
  • Filtering: Quickly search for commands by typing part of the command name. check ? for help.
  • Remote Makefile: Load a Makefile from a remote URL and execute commands.
  • Any Local Makefile: Load a Makefile from any directory and execute commands.
  • Taskfile.yml Support: Load a Taskfile.yml from a remote URL or local path and execute tasks.

Installation

mk can be installed using the following methods:

Homebrew
brew install orangekame3/tap/mk
Go Install
go install github.com/orangekame3/mk@latest
Manual Installation
  1. Download the latest release from the Releases
  2. Extract the archive and navigate to the extracted directory.
  3. Move the mk binary to a directory in your PATH.
mv mk /usr/local/bin

Usage

Prepare a Makefile with predefined commands and descriptions. Each command should be documented using a comment starting with ## to provide a description of the command.

SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help

.PHONY: test fmt
## Run tests
test:
 go test ./...

## Format source code
fmt:
 go fmt ./...

or you can set MK_DESC_POSITION=side in your .bashrc or .zshrc to show the description on the right side of the command.

SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help

.PHONY: test fmt

test: ## Run tests
 go test ./...

fmt: ## Format source code
 go fmt ./...

Run mk in your terminal to start the interactive interface. Select a command using arrow keys or filter by typing part of the command name. Press Enter to execute the selected command.

mk

This will display a list of available commands from the Makefile. Use the arrow keys to navigate and select a command, then press Enter to execute it.

Options

mk supports the following options:


mk is a CLI tool for executing make commands interactively.

Usage:
  mk [flags]

Flags:
  -f, --file string   Specify an input file other than Makefile (URL is also supported)
  -h, --help          help for mk
  -t, --taskfile      Use Taskfile.yml instead of Makefile
  -v, --version       version for mk
Load Makefile from a Remote URL

Use the -f or --file flag to load a Makefile from a remote URL. This allows you to execute commands from a Makefile hosted on a remote server.

mk -f https://raw.githubusercontent.com/orangekame3/mk/main/Makefile

[!NOTE] command executed at current directory.

Load Makefile from a Local File

Use the -f or --file flag to load a Makefile from a local file. This allows you to execute commands from a Makefile located in any directory.

mk -f /path/to/Makefile

[!NOTE] command executed at path/to directory, and return to the original directory after the command is executed.

Load Taskfile

Prepare a Taskfile.yml with predefined tasks and descriptions.

version: 3
tasks:
  test:
    cmds:
      - go test ./...
    description: Run tests
  fmt:
    cmds:
      - go fmt ./...
    description: Format source code

Use the -t or --taskfile flag to load a Taskfile.yml instead of a Makefile. This allows you to execute tasks from a Taskfile.yml.

mk -t

[!NOTE] It is usefule set alias in your .bashrc or .zshrc like alias tk='mk -t'.

Contact For questions or feedback, please contact at @orangekame3

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Acknowledgements

This project was inspired by fzf-make by @kyu08, make2help by @Songmu, and glow Thank you for the inspiration!

Author

👤 orangekame3

Documentation

Overview

Copyright © 2024 Takafumi Miyanaga <orangekame3.dev@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
Package cmd is a root command.
Package cmd is a root command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL