Function's comment is not printed out when putting it before the function's header
2
votes
4
answers
331
views
A good and well-established guideline for commenting a shell function is to put it before the function's header . I am trying to follow these guidelines as much as I can, but this convention makes it hard to read the function's comments. For instance, I don't have access to the comments of my function
#######################################
# init the current directory with the required files to work with latex in Vscode's extension LaTeX workshop
# Arguments:
# $1 -> Main .tex file. Optional. Default to "main.tex"
#######################################
initlatex () {
curl https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/0eeaa62d401659fe1c57602ec8f17608775d5338/_default_preamble.tex > default_preamble.tex
grep -q "\\input{default_preamble.tex}" ${1:-main.tex} || sed -i '2i\\\input{default_preamble.tex}\n' ${1:-main.tex}
curl https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/Makefile > Makefile
[[ ! -d .vscode ]] && mkdir --parents --verbose .vscode
curl https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/0eeaa62d401659fe1c57602ec8f17608775d5338/_vscode_makefile.json > .vscode/settings.json
}
directly on terminal by using the which
command:
❯ which initlatex
initlatex () {
curl https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/0eeaa62d401659fe1c57602ec8f17608775d5338/_default_preamble.tex > default_preamble.tex
grep -q "\\input{default_preamble.tex}" ${1:-main.tex} || sed -i '2i\\\input{default_preamble.tex}\n' ${1:-main.tex}
curl https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/Makefile > Makefile
[[ ! -d .vscode ]] && mkdir --parents --verbose --parents --verbose .vscode
curl https://gist.githubusercontent.com/tapyu/886dc95fc19c4250fb38581ccc58bed8/raw/0eeaa62d401659fe1c57602ec8f17608775d5338/_vscode_makefile.json > .vscode/settings.json
}
Is there another command to print out the function's comments without breaking this best practice?
Asked by Rubem Pacelli
(313 rep)
Jun 27, 2023, 12:24 AM
Last activity: Jun 28, 2023, 04:20 AM
Last activity: Jun 28, 2023, 04:20 AM