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 a way to dim specific exit codes #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lynxhug
Copy link

@lynxhug lynxhug commented May 17, 2020

I'm using terminal inside Dolphin so there is always 130 exit code in terminal panel when you change directory by clicking it. This commit is adding functionality to change color of return code module for specific exit codes to a different from specified in config file. Basically to grey out Control-C interrupt. With undefined new variables script will operate without changes.

Base automatically changed from master to main February 15, 2021 09:26
@chris-marsh
Copy link
Owner

Sorry I've not been very active here over the past while, but eventually coming back to PureLine and the PRs :)

I like the idea of dimming, but I'm thinking it might be simpler to not show 130's?

function return_code_segment {                                                                                                                                                                 
    [[ ${__return_code} -eq 0 || ${__return_code} -eq 130 ]] && return                                                                                                                         
                                                                                                                                                                                               
    local bg_color="$1"                                                                                                                                                                        
    local fg_color="$2"                                                                                                                                                                        
    local content rc_symbol                                                                                                                                                                    
    pl_symbol rc_symbol 'return_code'                                                                                                                                                          
    content="${rc_symbol} ${__return_code}"                                                                                                                                                    
    add_segment "$content" "$fg_color" "$bg_color"                                                                                                                                             
    __return_code=0                                                                                                                                                                            
} 

@lynxhug
Copy link
Author

lynxhug commented Mar 13, 2021

Completely hide exit code could be a problem if some other program use it for some reason rather than leaving it for the shell to signal that program was terminated by user. Also for confirmation sake i still want to know that any other programs that i do interrupt with ctrl+c is returning 130 exit code and not 0 for some reason. Probably very low chance for both occurrences but i would still prefer that no exit code on pureline will mean only 0 exit code.

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