greymd / tmux-xpanes

Awesome tmux-based terminal divider
MIT License
1.96k stars 61 forks source link

Implement xpns_log() #192

Closed ReDTerraN closed 1 year ago

ReDTerraN commented 1 year ago

Introducing xpns_log() This will replace following functions

This will consolidate our code and make it easier as its all in one function.

Features loglevels is now called via an positional argument, eg: xpns_log "error" "${_dir} is not writable."

we now have following values we can call:

New look to the logoutput It now comes with a new updated output to improve readability

old vs new xpanes:Info: This is an info message xpanes:Debug: [2023-04-18_15:24:33]:main:debug example

[xpanes:info] This is an info message [xpanes:debug:2023-04-18_15:24:33:main] debug example

Ability to parse multiple inputs

old function had the limitations to only parse the first positional argument it acquired. With xpns_log we can make how many arguments we wish.

For example:

old and new xpns_msg_info "this is an info message" "and here is more information" xpns_log "info" "This is an info message" "and here is more information"

this provides following input:

old xpanes:Info: this is an info message new [xpanes:info] This is an info message and here is more information

I have tested the function on all the input in xpanes, but should we ever get an issue with parsing the loglevel, we have a following output: [xpanes:internal error] invalid log type, if you get this error. Please file an issue on github: https://github.com/greymd/tmux-xpanes/issues

Referring to setup an issue on the project if it ever occurs. I have also made unit testing for the function to make sure we catch any issues.

Cheers

ReDTerraN commented 1 year ago

hmm, my unit test and shfmt tests works locally, But it does not work in the CI/CD pipeline. I will try later this week troubleshoot why it is the case.

ReDTerraN commented 1 year ago

All dependencies should now have been secured. But im unable to satistfy shfmt and I do not get an hint to what I need to fix.

Running the command locally provides me no hint to what is needed

shfmt -i 2 -ci -sr -kp -d ./bin/xpanes ./*.sh
 echo $?
0

@greymd If you can assist that would be greatly helpful, other than that I now believe its ready to reviewed.

Thanks :)

greymd commented 1 year ago

Running the command locally provides me no hint to what is needed

Oh really, ok I am taking a look..

ReDTerraN commented 1 year ago

Thanks @greymd, I have now applied the docker container to my workflow instead of running it locally. All checks should now be done.