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

[Draft] Git support #9

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

[Draft] Git support #9

wants to merge 3 commits into from

Conversation

MalauD
Copy link
Contributor

@MalauD MalauD commented Feb 22, 2022

What i want to implement:

  • Current branch and files modified
  • Optionally see how many lines were added/deleted
  • Customization of how everything is visualized (colors, position) using .vshrc.toml (might require a run time formatting library such as runtime-fmt)
  • Auto complete on git commands

Some observation regarding this pr:

  • It introduces a lot of new dependency and some of these are quite heavy (openssl) so may be the choice of git2 is not the best idea. I made this choice because it's quite popular and has every functionality of git.
  • Storing and recreating an instance on every prompt is not ideal, i'm currently looking for a better implementation, if you have any suggestion, please do a suggestion.
  • It might be a good idea to implement git as a plugin

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 22, 2022

I do not think there is any other option than making an instance on every prompt, many shells are quite slow due to this reason. And on the topic of plugins, it absolutely makes sense to give the end user a stock prompt in the beginning and they can add plugins one by one to add up to their likings, but until vshlang is not implemented I do not think that would be possible, shipping rust binaries would be redundant so I will be implementing piping, inbuilt commands proc macro first then move on to creating the language.

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 22, 2022

I will review the code tomorrow, I don't think our time zones sync

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 23, 2022

I would recommend making a utils folder, the files that I have in the src dir contain the main functionality of the application. Having a git file would be out of place, this way you can also put highlight.rs in there maybe also utils.rs with another name

@MalauD
Copy link
Contributor Author

MalauD commented Feb 24, 2022

Ok so i did what you said about file structures, tell me if it seems correct. I also added line of code modified visualization on the prompt but i think it's kinda superfluous. That's why i'm going to open a new pull request for runtime formatting (which might be related to a theme system) i will give more information on the pr description.

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 24, 2022

in src/utils/mod.rs do:

pub mod git;
pub mod highlight;
pub mod utils;

rather than

pub use {git::*, highlight::*, utils::*};

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 24, 2022

could you provide a screenshot of the prompt achieved with your new changes?

@MalauD
Copy link
Contributor Author

MalauD commented Feb 24, 2022

for the mod.rs i don't think this is a good idea since we will have a lot of nesting in our project( e.g. crate::utils::utils::PromptEffects). So for a screenshot here is an example:
updategit
However, this not the final result since as i said i will do some templating to allowmaximum customization.

Can we have another mean of communication like slack or gitter, it will be more simple and avoid going back and forth on pr ?

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 24, 2022

sure I have a gitter account never used it much though, If you have discord I have it linked in my profile (vλimer9#0976)

@Vaimer9
Copy link
Owner

Vaimer9 commented Feb 24, 2022

https://gitter.im/Vaimer9/vsh here's the gitter link for vsh

@MalauD MalauD mentioned this pull request Feb 25, 2022
10 tasks
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.

2 participants