Fix list - obey command #43

Open
Iam_Tj wants to merge 1 commit from Iam_Tj/BSSG:fix-list_obey_command into main
Contributor

I was surprised and confused when, after only adding a single page, it was not listed and furthermore the command didn't seem to even look for pages. With further investigation it seems the default command is incorrectly hard-coded in bssg.sh. The result:

$ find ${BSSG_LCONF%/*}/pages
/home/tj/public_html2/pages
/home/tj/public_html2/pages/page-1.md

$ ./bssg.sh list pages
Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local
[SUCCESS] Default configuration loaded from config.sh
[SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local
[INFO] Loading locale: en from locales/en.sh
[INFO] Expanding tilde (~) in configuration paths...
Central configuration loaded via config_loader.sh
DEBUG: bssg.sh main() args: list pages
DEBUG: list.sh main() args: posts
Available posts in '/home/tj/public_html2/src':
No posts found in '/home/tj/public_html2/src'.

With this patch it works correctly:

$ ./bssg.sh list pages
Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local
[SUCCESS] Default configuration loaded from config.sh
[SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local
[INFO] Loading locale: en from locales/en.sh
[INFO] Expanding tilde (~) in configuration paths...
Central configuration loaded via config_loader.sh
Available pages in '/home/tj/public_html2/pages':
Path                            Date            Title
----                            ----            -----
/home/tj/public_html2/pages/page-1.md                           2025-10-13 14:33:05 +0000       Page 1

$ ./bssg.sh list posts
Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local
[SUCCESS] Default configuration loaded from config.sh
[SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local
[INFO] Loading locale: en from locales/en.sh
[INFO] Expanding tilde (~) in configuration paths...
Central configuration loaded via config_loader.sh
Available posts in '/home/tj/public_html2/src':
No posts found in '/home/tj/public_html2/src'.

$ ./bssg.sh list
Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local
[SUCCESS] Default configuration loaded from config.sh
[SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local
[INFO] Loading locale: en from locales/en.sh
[INFO] Expanding tilde (~) in configuration paths...
Central configuration loaded via config_loader.sh
Available posts in '/home/tj/public_html2/src':
No posts found in '/home/tj/public_html2/src'.
I was surprised and confused when, after only adding a single page, it was not listed and furthermore the command didn't seem to even look for pages. With further investigation it seems the default command is incorrectly hard-coded in `bssg.sh`. The result: ``` $ find ${BSSG_LCONF%/*}/pages /home/tj/public_html2/pages /home/tj/public_html2/pages/page-1.md $ ./bssg.sh list pages Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local [SUCCESS] Default configuration loaded from config.sh [SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local [INFO] Loading locale: en from locales/en.sh [INFO] Expanding tilde (~) in configuration paths... Central configuration loaded via config_loader.sh DEBUG: bssg.sh main() args: list pages DEBUG: list.sh main() args: posts Available posts in '/home/tj/public_html2/src': No posts found in '/home/tj/public_html2/src'. ``` With this patch it works correctly: ``` $ ./bssg.sh list pages Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local [SUCCESS] Default configuration loaded from config.sh [SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local [INFO] Loading locale: en from locales/en.sh [INFO] Expanding tilde (~) in configuration paths... Central configuration loaded via config_loader.sh Available pages in '/home/tj/public_html2/pages': Path Date Title ---- ---- ----- /home/tj/public_html2/pages/page-1.md 2025-10-13 14:33:05 +0000 Page 1 $ ./bssg.sh list posts Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local [SUCCESS] Default configuration loaded from config.sh [SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local [INFO] Loading locale: en from locales/en.sh [INFO] Expanding tilde (~) in configuration paths... Central configuration loaded via config_loader.sh Available posts in '/home/tj/public_html2/src': No posts found in '/home/tj/public_html2/src'. $ ./bssg.sh list Info: Using configuration file specified via BSSG_LCONF environment variable: /home/tj/public_html2/config.sh.local [SUCCESS] Default configuration loaded from config.sh [SUCCESS] Command-line configuration loaded from /home/tj/public_html2/config.sh.local [INFO] Loading locale: en from locales/en.sh [INFO] Expanding tilde (~) in configuration paths... Central configuration loaded via config_loader.sh Available posts in '/home/tj/public_html2/src': No posts found in '/home/tj/public_html2/src'. ```
The sub-command passed to list.sh::main() was hard-coded with "post" and
therefore could never list pages.

Signed-off-by: Tj <tj.iam.tj@proton.me>
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u fix-list_obey_command:Iam_Tj-fix-list_obey_command
git switch Iam_Tj-fix-list_obey_command

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff Iam_Tj-fix-list_obey_command
git switch Iam_Tj-fix-list_obey_command
git rebase main
git switch main
git merge --ff-only Iam_Tj-fix-list_obey_command
git switch Iam_Tj-fix-list_obey_command
git rebase main
git switch main
git merge --no-ff Iam_Tj-fix-list_obey_command
git switch main
git merge --squash Iam_Tj-fix-list_obey_command
git switch main
git merge --ff-only Iam_Tj-fix-list_obey_command
git switch main
git merge Iam_Tj-fix-list_obey_command
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
stefano/BSSG!43
No description provided.