aboutsummaryrefslogtreecommitdiff
path: root/tests/cli-opts.sh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mv src/git-permalink.sh.in src/git-permalin.inEuAndreh2021-06-251-14/+14
| | | | | Mostly to avoid the conflict of the ".sh" built-in rule in the Makefile.
* Fix tests: git grep -l 'sh git-permalink' | xargs sed -i 's|sh ↵EuAndreh2021-06-231-14/+14
| | | | git-permalink|sh src/git-permalink.sh|g'
* tests/cli-opts.sh: Stop testing behaviour of "locale" commandEuAndreh2021-06-221-9/+0
|
* src/git-permalink.sh.in: Fix #task-bebbe847-f552-be4b-b886-70a621162b69EuAndreh2021-06-221-4/+2
| | | | | | | | | | | | | The issue wan't with getopts but with my usage of it (well, now that's obvious that the problem wouldn't be in the implementation, but on how I was using). The problem was on: 1) my confusion on when and where to "shift"; 2) make sure to look for the "--help" and "--version" long flags before getopts, because it doesn't know about long flags. Those fixed, the tests are now working again.
* tests/cli-opts.sh: Use portable "sh git-permalink" over "./git-permalink"EuAndreh2021-06-221-15/+15
|
* tests/cli-opts.sh: Add test_langsEuAndreh2021-06-221-0/+70
|
* src/git-permalink.sh: Translate program output to pt, fr and eoEuAndreh2021-06-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The choice of implementation was very basic: Use strings in the script itself rather than relying on external tools. Compared to a compiled C program using, say, gettext.3, an sh script could also depend on it, but at runtime. An equivalent C code would require the gettext.3 dependency, but at compile time. After compilation, the code required for doing the translation is already on the binary, while an sh script would need gettext.1 to run gettext.1 commands while it executes, such as "gettext -s 'MSG_ABC'". Bash has a very appealing feature: using $"" does a lookup and translates the string. In other words, $"" runs gettext for you, without the script requiring gettext.1, just Bash. As tempting as it was, I chose not to rely on Bash. I preferred the cost of an ad-hoc solution over requiring Bash over POSIX sh. The final solution is simple enough for the git-permalink.1 program, but wouldn't scale for bigger scripts. Strings are placed together for translation, and no external tool is used for this. Due to the way that strings are now given to printf.1, ShellCheck complains a lot about those strings, alonside saying that the string translation variables are unused. They actually are used, but hidden behind an eval. Overall I'm satisfied with the solution, but I probably won't follow the same path for the manpages, and will choose something like po4a for it, instead.
* tests/cli-opts.sh: Remove behaviour testEuAndreh2021-06-121-25/+0
| | | | | | | | The test that was removed relies on how the repository was clone. For example, the CI clone the repository as a remote folder, and uses that for the origin remote. The test fails because of that, and instead of trying to fix it, I removed it.
* Revert "tests/xdg-open: Remove unused file"EuAndreh2021-06-121-0/+2
| | | | | | | This reverts commit d3faf9644490a191a16c148a3f4f865b730e5188. The file was not actually unused, but used in tests to avoid side effects when running them.
* src/git-permalink.sh: Fix bad treatment of -p flagEuAndreh2021-06-121-2/+12
|
* tests/xdg-open: Remove unused fileEuAndreh2021-06-121-2/+0
|
* Add initial version of tests/cli-opts.sh testsEuAndreh2021-06-121-0/+108
|
* Add stup tests/cli-opts.shEuAndreh2021-06-121-0/+0