fkill-cli icon indicating copy to clipboard operation
fkill-cli copied to clipboard

Rewrite in Ink

Open jopemachine opened this issue 2 years ago • 3 comments

Fixes #34.

It seems working now but I think I need to a little more time to look into more error handling logics and test codes and lint (WIP). Thank you for all your efforts for maintaining awesome libs.

jopemachine avatar Mar 09 '22 05:03 jopemachine

  • This PR adds react, babel to dependencies to rewrite in ink, and removes inquirer from dependencies.
  • Some features not having unit tests were tested by myself in macos.
  • Lots of existing logic in interactive.js are moved to utils.js to separate UI codes with process fetching, searching codes.
  • I tried to maintain fkill-cli's existing action as possible as I can, but some actions might be changed due to using ink-select-input, ink-text-input. If this couldn't be accepted, please let me know. I will try to make the components instead of using them.
  • Some style (including text color) might have been changed a little bit.

jopemachine avatar Mar 09 '22 12:03 jopemachine

When searching, if you write a word, you should be able to press option+left-arrow to go back to the start, or option+right-arrow to go to the end. This worked before this PR.

Pressing Option+Delete when at the end of the search line, should clear the search text too.

sindresorhus avatar May 02 '22 02:05 sindresorhus

In case you are interested in making some improvements over the old version too:

  • The "(Move up and down to reveal more choices)" text should only be shown on the first launch (of the interactive UI). Same with "(Use arrow keys or type to search)".
  • You should be able to search for a port using the :8080 syntax. I was sure this was already supported, but does not seem to work in the latest version.

sindresorhus avatar May 02 '22 03:05 sindresorhus

@jopemachine Still interested in finishing this?

sindresorhus avatar Nov 20 '22 09:11 sindresorhus

@jopemachine Still interested in finishing this?

Yes, I'm definitely interested in this issue and other current issues of fkill-cli.

So, there are some issues to look into.



  • [x] Require statement issue
  • [x] When searching, if you write a word, you should be able to press option+left-arrow to go back to the start, or option+right-arrow to go to the end. This worked before this PR.
  • [x] Pressing Option+Delete when at the end of the search line, should clear the search text too.

: For implementing these features, I think updating ink-text-input, ink-select-input is required, but I don't think I can expect some reply at this point. I'm wondering what you think about how to handle this. What do you think about removing these libs and reimplementing this logic? Could I get some advice about this?


  • [x] You should be able to search for a port using the :8080 syntax. I was sure this was already supported, but does not seem to work in the latest version.

: I think I can look into it when available.

jopemachine avatar Nov 20 '22 10:11 jopemachine

https://github.com/sindresorhus/fkill-cli/pull/83#discussion_r862568130, I'm not sure about this.. Is this issue resolved now?

Check the output whether it's ESM or CJS. You may have set the modules option per the Babel comment.

sindresorhus avatar Nov 20 '22 11:11 sindresorhus

https://github.com/sindresorhus/fkill-cli/pull/83#discussion_r862568229

Just add a TODO comment about fixing it when Ink properly supports ESM.

sindresorhus avatar Nov 20 '22 11:11 sindresorhus

When searching, if you write a word, you should be able to press option+left-arrow to go back to the start, or option+right-arrow to go to the end. This worked before this PR. Pressing Option+Delete when at the end of the search line, should clear the search text too.

I think we can live without these for now. We'll just open new issues about fixing it at some point.

sindresorhus avatar Nov 20 '22 11:11 sindresorhus

You should be able to search for a port using the :8080 syntax. I was sure this was already supported, but does not seem to work in the latest version.

Yes, that should ideally work. Not sure when it broke.

sindresorhus avatar Nov 20 '22 11:11 sindresorhus

Check the output whether it's ESM or CJS. You may have set the modules option per the Babel comment.

I'm not sure what is the Babel comment you mentioned, although the output is ESM.

Just add a TODO comment about fixing it when Ink properly supports ESM.

I think this is not required since ink-text-input, ink-select-input are not used now.

I think we can live without these for now. We'll just open new issues about fixing it at some point.

I copy and pasted the above two repositories' source code and patched the ink-text-input for support delete, option key features in https://github.com/sindresorhus/fkill-cli/pull/83/commits/b157fd69c0cb59cdb3b1294d62328d255964cae4.

Yes, that should ideally work. Not sure when it broke.

I'm not sure about the cause but I checked this feature worked normally in 5.2.0, but broke in 6.0.0, maybe inquirer 7's default behavior change? I added the feature since I don't see port-searching related code.

I'd appreciate your letting me know if there's anything else I could help.

jopemachine avatar Nov 21 '22 14:11 jopemachine

Can you fix the merge conflict?

sindresorhus avatar Nov 23 '22 07:11 sindresorhus

Write foo in the prompt and then hold Option key while pressing Delete. The cursor moves backwards, but the text is not deleted. The expected behavior is that the whole text is erased after on press of Delete.

If you do the same, but hold Command instead Option, it adds a u character.

sindresorhus avatar Nov 23 '22 08:11 sindresorhus

Bump

sindresorhus avatar Apr 26 '23 08:04 sindresorhus

@sindresorhus I am still interested in finishing this PR, I was struggling with the key code testing logic on the cross-platform. Personally, I have been so busy with work that I apologize for the late response. If there is anyone interested in this PR, I would really appreciate it if you could finish the work. I will try to find time to complete this PR, but I am not sure exactly when that will be.

jopemachine avatar May 01 '23 03:05 jopemachine

No worries. But since there's no definite date of that happening, I prefer to close this for now to keep my PR queue clean. Feel free to submit a new pull request if/when you have time to finish this.

sindresorhus avatar Jun 20 '23 11:06 sindresorhus