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

[Plugin]: shrs_cd_tools inject module specific metadata directly to state #477

Open
MrPicklePinosaur opened this issue Jun 3, 2024 · 0 comments
Assignees
Labels
C: plugin issues specific to an official plugin

Comments

@MrPicklePinosaur
Copy link
Owner

The current usage of cd_tools is to first query from the DirParseState, and then extract the module you desire.

fn prompt_right(state: State<DirParseState>, sh: &Shell) -> StyledBuf {
    let project_info = default_prompt(&state, sh);

    let git_branch = state
        .get_module_metadata::<Git>("git")
        .map(|git| format!("git:{}", git.branch));

   ...
}

There is no reason why we can't just inject Git state directly into shell State and query using

fn prompt_right(git_state: State<Git>, sh: &Shell) -> StyledBuf {
    let git_branch = format!("git:{}", git_state.branch);
   ...
}
@MrPicklePinosaur MrPicklePinosaur added the C: plugin issues specific to an official plugin label Jun 3, 2024
@nithinmuthukumar nithinmuthukumar self-assigned this Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: plugin issues specific to an official plugin
Projects
None yet
Development

No branches or pull requests

2 participants