[Bug 272054] [NEW PORT] sysutils/gh-md-toc: Easy TOC creation for GitHub README.md
Date: Fri, 30 Jun 2023 20:58:12 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=272054 Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #242850|0 |1 is obsolete| | Attachment #243084| |maintainer-approval+ Flags| | --- Comment #2 from Jesús Daniel Colmenares Oviedo <DtxdF@disroot.org> --- Created attachment 243084 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=243084&action=edit gh-md-toc-0.8.0.patch Thanks for reviewing my patch and sorry for taking so long to respond. --- > does this script run with /bin/sh? If yes, we could eliminate the bash dependency. Not by default, but I have patched gh-md-toc to work seamlessly with sh(1). > could you patch the script to use fetch(1) instead of wget(1) or curl(1)? This would permit elimination of these dependencies. Unfortunately, fetch(1) doesn't allow you to set the headers that the Github needs to set the token, but I've read gh-md-toc carefully and I think ftp/wget doesn't make sense as the README says. ``` gh_toc_load() { local gh_url=$1 if type curl &>/dev/null; then curl --user-agent "$gh_user_agent" -s "$gh_url" elif type wget &>/dev/null; then wget --user-agent="$gh_user_agent" -qO- "$gh_url" else echo "Please, install 'curl' or 'wget' and try again." exit 1 fi } ``` The above code only makes sense if wget or curl is used depending on the user's preferences in the following code. ``` OUTPUT=$(curl -s \ --user-agent "$gh_user_agent" \ --data-binary @"$gh_tmp_file_md" \ -H "Content-Type:text/plain" \ -H "$AUTHORIZATION" \ "$URL") ``` The above code creates a dependency so the user must install ftp/curl and the gh_toc_load() will match curl first, so ftp/wget makes no sense. I simply remove it to have less dependencies. --- All other mentioned problems have been fixed and I have also patched gh-md-toc in some parts that may create new problems, such as: ``` gh-md-toc --version 0.8.0 os: FreeBSD 13.2-RELEASE kernel: 1302001 shell: /bin/csh grep : grep (BSD grep, GNU compatible) 2.6.0-FreeBSD awk : awk version 20210215 sed : sed (BSD sed) fetch: fetch (BSD fetch) ``` -- You are receiving this mail because: You are the assignee for the bug.