emc.fish
emc.fish copied to clipboard
Add options for users to add their own config files and command
Which issue(s) this PR fixes (If applicable): #117
Checklist
- [x] I have followed the Contribution Guidelines and Code of Conduct.
- [x] I have commented my code following the Styleguide.
- [x] Relevant documentation is changed or added.
- [x] This is NOT A BREAKING CHANGE.
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:
-
emc add <name> <path/to/file/from/home>
- Let users add their own config files -
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. -
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
Adding option already added, even with another file
Listing out options after addition
Removing Option
Removing previously removed option
Listing out options after removal
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
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