Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make supporting command runners other than make possible like npm, pnpm, yarn and just, e.t.c. #315

Closed
2 tasks done
kyu08 opened this issue Oct 11, 2024 · 2 comments
Closed
2 tasks done
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@kyu08
Copy link
Owner

kyu08 commented Oct 11, 2024

Requirements

  • Detect what package manager is used by file name of lockfile. (like this https://github.com/azu/ni.zsh/blob/1b33b73335235003e28dca56ba73d24afe2e626a/ni.zsh )
  • If multiple types of runner like make and npm, fzf-make shows all command like below.
    > test(make)
      go-lint(make)
      lint(pnpm)
      run(pnpm)
    
  • When fzf-make saves histories, it may need what package manager is used to run the command.
  • Thought: When a command is selected, it might better to show prompt to ask user to execute it for sure like This executes "npm run test". Are you sure?.
    • If so, make it configurable to show the prompt or not.

TODO(Before this enhancement)

@kyu08 kyu08 added the enhancement New feature or request label Oct 11, 2024
@kyu08 kyu08 self-assigned this Oct 11, 2024
@kyu08
Copy link
Owner Author

kyu08 commented Oct 18, 2024

AsIs

pub enum AppState<'a> {
    SelectTarget(SelectTargetState<'a>),
    ExecuteTarget(Option<String>),
    ShouldQuit,
}

ToBe

pub enum AppState<'a> {
    SelectTarget(SelectTargetState<'a>),
    ExecuteTarget(Option<Command>), // Change to Command
    ShouldQuit,
}

pub trait Command {
    fn print(&self); // Print command to run like `make run` before execute it.
    fn execute(&self);
}
  • Implement method like makefile.to_command(target).

kyu08 added a commit that referenced this issue Nov 11, 2024
… able to add other command runner like pnpm, yarn, etc. #315 (#321)

* define Runner trait

* wip: Implement Makefile runner

* rename: model::Makefile -> model::Make

* add: implement Selector for Make

* fix: use Selector trait from caller side

* rename: makefile -> runners

* fix: append_history

* fix: narrow_down_targets

* fix: app.rs

* fix: history x UI周辺を追従

* add: command::Command

* fix: comment

* wip: trait object

* wip: enum

* Command

* fix: comment

* delete: pnpm

* comment out history related test code

* treat with temporal dead code

* delete dead code

* fix: how to print command to run

* chore: refactor
@kyu08 kyu08 added this to the Next release milestone Nov 15, 2024
kyu08 added a commit that referenced this issue Nov 24, 2024
…runner like pnpm, yarn, e.t.c. #315 (#324)

* empty commit

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* read history

* write history

* append_history

* delete unnecessary code

* specify_makefile_name: receive current_dir as an argument instead of using `env::current_dir`

* delete unnecessary code

* fix comment

* use command.runner_type.to_runner instead of s.runners[0]

* SelectTargetState.histories: Add comment

* add pretty_assertions

* rename

* histories.append

* history.append

* comment in tests temporary disabled

* rename: target -> command

* Add a comment tells that the the commands are sorted by executed time descending in the history file.

* format import statements

* remove unnecessary comment

* make `content_to_include_file_paths` private

* delete unnecessary path specification

* make.rs: rename create_makefile to new, new to new_internal

* change format to display command: (runner_type) name -> [runner_type] name]

* model/histories.rs: fix comment

* make some methods private

* rename var name

* rename: store_history -> create_or_update_history_file

* delete unnecessary code

* reoder import block
@kyu08 kyu08 closed this as completed Nov 24, 2024
@kyu08 kyu08 changed the title Support some JavaScript package manager like npm, pnpm, yarn and bun Make supporting some JavaScript package manager possible like npm, pnpm, yarn and bun Nov 24, 2024
@kyu08 kyu08 changed the title Make supporting some JavaScript package manager possible like npm, pnpm, yarn and bun Make supporting command runners other than make possible like npm, pnpm, yarn and just, e.t.c. Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant