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

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Oskar-Idland
Copy link

@Oskar-Idland Oskar-Idland commented Jan 11, 2024

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

Checklist

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting).
  • Refactoring (no functional changes).
  • Build or CI related changes.
  • 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

…ortcut

emc function gets new options to add, remove or list their own config files.
options are  in a text file (conf.d/emc_options.txt).
refactored code for opening config files to avoid repetition
README contains explanation of new options
Copy link
Owner

@demartini demartini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @Oskar-Idland, I just did the review and your contribution is wonderful.

Could you fix the .txt extension as mentioned in your last comment, so that I can make the merge?

@Oskar-Idland
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants