emc.fish icon indicating copy to clipboard operation
emc.fish copied to clipboard

Add options for users to add their own config files and command

Open Oskar-Idland opened this issue 1 year ago • 1 comments

Which issue(s) this PR fixes (If applicable): #117

Checklist

What kind of change does this PR introduce?

  • [ ] Bugfix.
  • [x] Feature.
  • [ ] Code style update (formatting).
  • [x] Refactoring (no functional changes).
  • [ ] Build or CI related changes.
  • [x] Documentation content changes.
  • [ ] Project automation.
  • [ ] Other...
    • [ ] Please describe:

Description of Change

  • Added three new functions:
    1. emc add <name> <path/to/file/from/home> - Let users add their own config files
    2. emc list - Let users see all their config files and their command. Good for seeing formatting issues if something is wrong or just to remember all commands.
    3. emc remove <name> - Let users remove commands, even default ones
  • Added new txt file to store the commands and their respective config files, in conf.d/emc_options.txt
  • Refactored some of the code to reduce error prone repetition

What is the current behavior?

Currently there are no options to add or remove commands

What is the new behavior?

Ability to add or remove commands, and see all commands, including user made

Does this PR introduce a breaking change?

No. I have tested the code a lot myself, and it work as expected. The old functionality works just the same and the new one as well.

Screenshots

Adding option

image

Adding option already added, even with another file image

Listing out options after addition image

Removing Option image

Removing previously removed option image

Listing out options after removal image

Other Information

  • I am no expert so there is of course the possibility of some string manipulation could happen to not be the "proper" fish way or have some vulnerability, but it works when tested. I have only used the fish language.
  • I do not know if more needs to be added in terms of removing files if someone uninstalls the plugin
  • In the future it would be nice to automate the completion code to add the new stuff. Same with the help function

Oskar-Idland avatar Jan 11 '24 13:01 Oskar-Idland

I'm a bit busy right now, but will do asap. I have done more on my branch which needs to be merged, so I might just create a new PR

Oskar-Idland avatar May 16 '24 17:05 Oskar-Idland