-
Notifications
You must be signed in to change notification settings - Fork 12
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
FEATURE: add tool functions for logging to bump.sh
#67
FEATURE: add tool functions for logging to bump.sh
#67
Conversation
The following `nushell` little script have been used to replace them automatically ```bash let file = "scripts/bump.sh" [ [token tool]; ["\\+" info] [~ warning] [! error] [i ok] [- normal] ["\\?" hint] ] | each {|it| # replace "echo '[.] " or 'echo "[.] ' by the right log function sd $"echo \('|\"\)\\[($it.token)\\] " $"log_($it.tool) $1" $file } ``` One can see that all the `echo`s have been replaced by looking at ```bash > rg "echo .\\[.\\]" scripts/bump.sh ``` before and after the replacement above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two slight issues to solve 😋
About the names/colors I would suggest:
log_ok
--> log_info
log_info
--> log_ok
[-]
is the real error
I think 🤔 I just wrongly use [!]
once or twice, could you replace every [!]
(currently log_error
) by [-]
and rename log_normal
--> log_error
(using red then)
don't think it's crystal clear sorry about that!
This commits helps mitigate the following error ```bash > ./scripts/bump.sh ./scripts/bump.sh: line 159: syntax error: unexpected end of file ``` The `bash` interpreter needs a ";" at the end of the lines inside a oneline `{ ... }` block, just as in the `log_*` functions. Otherwise, the parser does not know where the line ends, throwing the error above.
This commit helps mitigate the following error ```bash > DRY_RUN="yes" ./scripts/bump.sh [i] Current [-] Exactly [?] Example: [?] see ``` i.e. the `log_*` functions only print the first word they are being given... This is because of the `log_any ... $1`, as `log_any` takes the `$3` only and not everything after the fourth argument. Writing `log_any ... "$1"` makes sure the `$3` argument is made of all the message and not the first word only!! With this commit, the output of the same command as above is now ```bash > DRY_RUN="yes" ./scripts/bump.sh [i] Current directory is repo's root OK [-] Exactly one argument is needed, got 0. [?] Example: `./bump.sh 0.2.6` [?] see https://github.com/iScsc/iscsc.fr/wiki/Version-bump-procedure#automatic-version-bump for full documentation ```
i'm not 100% sure, but tell me if what i've tried below is fine 😋
if that's what you meant, i'll push these two commits on the PR branch 😉 |
Actually almost! |
like this? 😏
|
@amtoine looks perfect! Apart from this I think your PR is ready to be merged 😉 |
got it 👌
great 💪 |
I'll check within the week! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay!
I totally approve this update!
@amtoine I think the chnages we discussed are still on your |
woooopsie, yep 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great improvement tks a lot!
This PR
log_*
tool functions to wrap theecho "[.] ..."
in an easier to modify frameworkecho "[.] ..."
by their appropriatelog_* "..."
counterpartthings to pay attention to
given the content of the various
[.]
in the script, i've come up with the following transition tablelog_error
log_ok
log_warning
log_hint
log_info
log_normal
👉 i'm not sure about the exact names and the colors...
🙏 please tell me if any of them should change!!