Giter Site home page Giter Site logo

kyu08 / fzf-make Goto Github PK

View Code? Open in Web Editor NEW
53.0 2.0 8.0 26.88 MB

A command line tool that executes make target using fuzzy finder with preview window.

License: MIT License

Makefile 2.89% Rust 95.51% Nix 1.60%
cli fuzzy-finder fzf make makefile rust tui hacktoberfest ratatui terminal

fzf-make's Introduction

fzf-make is a command line tool that executes make target using fuzzy finder with preview window.

License:MIT Latest Release crates.io

[English] [Deutsch] [Français]

🛠️ Features

  • Select and execute a make target using fuzzy-finder
  • Execute last executed target(By running fzf-make --repeat.)
  • Command history
  • Support include directive
  • (Scheduled to be developed) Support config file

👓 Prerequisites

  • bat (In the future, we intend to make it work with cat as well, but currently it only works with bat.)

📦 Installation

macOS

Homebrew

You don't need to install bat because fzf-make will install it automatically via Homebrew.

# install
brew install kyu08/tap/fzf-make
# update 
brew update
brew upgrade fzf-make

Arch Linux

fzf-make can be installed from the AUR using an AUR helper. For example:

paru -S fzf-make

NixOS / Nix (package manager)

fzf-make can be run from the repository (latest version)

nix run github:kyu08/fzf-make

Or from the nixpkgs (channel >= 23.05)

nix run nixpkgs#fzf-make

Note You may need to enable experimental feature. In that case, execute the following command to enable them echo "experimental-features = nix-command flakes" | tee ~/.config/nix/nix.conf

OS-independent method

Cargo

cargo install --locked fzf-make

💡 Usage

Run target using fuzzy finder

  1. Execute fzf-make in the directory include makefile(file name should be one of GNUmakefile, makefile, Makefile)
  2. Select make command you want to execute. If you type some characters, the list will be filtered. demo demo

Run target from history

  1. Execute fzf-make in the directory include makefile(file name should be one of GNUmakefile, makefile, Makefile)
  2. Press Tab to move to the history pane.
  3. Select make command you want to execute. demo

Commands Supported

Command Description
fzf-make Launch fzf-make
fzf-make --repeat / fzf-make -r / fzf-make repeat Execute last executed target
fzf-make --help / fzf-make -h / fzf-make help Show help
fzf-make --version / fzf-make -v / fzf-make version Show version

💻 Development

  1. Clone this repository
  2. Change the codes
  3. Run make run

To execute test, run make test(needs nextest).

nix

Or you can use nix to create a development shell with the project dependencies.

Within the repo root, execute the following command:

nix develop

👥 Contribution

  • Contributions are welcome!
  • If you have a Feature request, please create an issue first.
  • If you have added fzf-make to some package manager, please let me know. (or please send a PR to add how to install via the package manager in the README.md)
  • If you have any questions, feel free to create an issue and ask.

🗒 Related Article(s)

fzf-make's People

Contributors

a-kenji avatar adityaranjanjha avatar engineerakki avatar jaus14 avatar khanh130202 avatar kyu08 avatar orhun avatar renovate[bot] avatar sigmanificient avatar wrth1337 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fzf-make's Issues

Add crates.io badge to README

TODO

  • Add badge to readme
    • en
    • german

Format might be following:

  ![crates.io](https://img.shields.io/crates/v/fzf-make?style=flatflat-square)

that shows like this.

crates.io

[Tell me your opinion!] Support config file

I think it's good idea to support config that enables to configure behavior which has file format such as yaml.
Possible settings would include the following:

  • Direction of preview window(vertical / horizontal)
  • Preview command(bat / cat)
  • Show executed command or not
  • Behavior when return key is pressed(Run the target / Just show make ${selected_target} to prompt?(I'm not sure if possible)y)
  • Forcus the target executed at the last time
  • etc...

Please let me know options you want! 😀
Also I welcome your feature requests!

release v0.5.0

https://qiita.com/kcwebapply/items/4777dfc9151ebb3e8a19

  1. make build-releaseを実行してバイナリを生成
  2. バイナリを含めてタグ打ちリリース
  3. brew create https://github.com/kyu08/fzf-make/archive/refs/tags/v0.5.0.tar.gzを実行してsha256を取得
  4. kyu08/homebrew-tap fzf-make.rbのsha256を書き換えてpush
  5. ローカルでbrew update, brew upgrade fzf-makeを実行してダウンロードでエラーが出ないことを確認

Check bat is installed or not

It may be better giving option through config file like.
And use cat by default.

preview_command: bat # or cat
  • Delete bat dependency from Homebrew Formula.

Simplify release

# AsIs
1. Run make bump-fzf-make-version locally to update version of cargo.toml
1. Create PR and merge into main
1. Create release on GitHub (GitHub Actions runs cargo publish and update brew formula automatically)

# ToBe
- Execute release on GitHub Actions to do all of the above
- Execute make release locally to do all of the above(kick GitHub Actions)

AsIs

  • When make bump-fzf-make-version executed, commit, push, and fill PR are executed

ToBe

  • When make bump-fzf-make-version executed, commit, push, and create and merge PR to main, then make draft release

Setup CI/CD

CI

  • cargo test
  • cargo check
  • cargo fmt

CD

  • something make release easier

update README

  • save gif within this repo
  • update demo gif
  • write features(support include directive ...)

reconsider module structure

Maybe skim related codes could be combined into one module.

Routing - Handler - Usecase のような層に分ける

Make sure it works on linux

It's fine to test using linux container image on Docker...? (I don't have linux machine)

TODO: Update my homebrew repo if needed. (for installation on linux)

update README

  • Makeの仕様完全対応はちょっと大変そうなのでREADMEに対応しているターゲットの形式を書いておく。
  • READMEにMakefile以外には対応していないことを書いておく(xxx.mkとかは未対応)

Command history

UI

image

Requirements

  • Display histories
    • Read and parse history
    • Add UI in History pane
    • Test
      • Pass a history file path and check whether parse result is valid
  • Update history
    • Update history when a target to be executed
      • Append a target to head of histories
      • Remove duplicates
    • Test
      • At first update history, and then check content of history struct
      • Check some conversions of struct to file is valid
  • Add fzf-make --repeat to execute the target last executed

Data structure of history file

  • ~/.config/fzf-make/history.toml
  • In the future, config file can be added. So this file is used only for history.
[[histories]]
path = "Users/john/projects/projectA"
executed-targets = ["test", "lint"]

[[histories]]
path = "Users/john/projects/projectB"
executed-targets = ["test", "lint"]

[[histories]]
path = "Users/john/projects/projectC"
executed-targets = ["test", "lint"]

Ignore statement like `some_var := 1`

Actual

If fzf-make was executed when following makefile exists, some_var and run is detected as target.

some_var := 1

.PHONY: run
run:
    go run main.go

Expected

some_var is not detected as target.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.