aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md12
-rw-r--r--doc/remembering.en.5.in2
-rw-r--r--doc/remembering.eo.5.in5
-rw-r--r--doc/remembering.fr.5.in5
-rw-r--r--doc/remembering.pt.5.in5
-rw-r--r--po/LC_MESSAGES/CHANGELOG.en.md/eo.po24
-rw-r--r--po/LC_MESSAGES/CHANGELOG.en.md/fr.po24
-rw-r--r--po/LC_MESSAGES/CHANGELOG.en.md/pt.po24
-rw-r--r--po/LC_MESSAGES/doc/remembering.en.5.in/eo.po8
-rw-r--r--po/LC_MESSAGES/doc/remembering.en.5.in/fr.po8
-rw-r--r--po/LC_MESSAGES/doc/remembering.en.5.in/pt.po8
-rwxr-xr-xsrc/remembering.in2
-rwxr-xr-xtests/cli-opts.sh5
-rwxr-xr-xtests/ranking.sh16
14 files changed, 118 insertions, 30 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 27e4178..826d846 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,18 @@ Changelog for [remembering](https://euandreh.xyz/remembering/en/).
## Changed
+### Use of `$XDG_DATA_HOME`
+
+When the environment variable `$XDG_DATA_HOME` is defined, remembering now
+appends a trailing `/remembering` to it instead of start writing files to where
+the environment variable points to.
+
+This is in conformance with the [XDG Base Directory Specification][xdg].
+
+[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+
+### Exit code
+
When remembering encounters an unrecognized option, it now exits with 2 instead of ignoring it.
diff --git a/doc/remembering.en.5.in b/doc/remembering.en.5.in
index 787a1ea..367e72b 100644
--- a/doc/remembering.en.5.in
+++ b/doc/remembering.en.5.in
@@ -8,7 +8,7 @@ remembering - format of the \fIPROFILE\fR text file.
.SH PROFILE
-The \fIPROFILE\fR is a text file, stored on \f(CR$XDG_DATA_HOME/profile-name\fR if \f(CR$XDG_DATA_HOME\fR is defined.
+The \fIPROFILE\fR is a text file, stored on \f(CR$XDG_DATA_HOME/remembering/profile-name\fR if \f(CR$XDG_DATA_HOME\fR is defined.
Otherwise, it lives in \f(CR~/.local/share/remembering/profile-name\fR.
Each line of the \fIPROFILE\fR contains three pieces of information:
diff --git a/doc/remembering.eo.5.in b/doc/remembering.eo.5.in
index 27a1f76..f3f550f 100644
--- a/doc/remembering.eo.5.in
+++ b/doc/remembering.eo.5.in
@@ -13,8 +13,9 @@ remembering \- format of the \fIPROFILE\fP text file.
.SH PROFILE
-The \fIPROFILE\fP is a text file, stored on \f(CR$XDG_DATA_HOME/profile\-name\fR
-if \f(CR$XDG_DATA_HOME\fR is defined. Otherwise, it lives in
+The \fIPROFILE\fP is a text file, stored on
+\f(CR$XDG_DATA_HOME/remembering/profile\-name\fR if \f(CR$XDG_DATA_HOME\fR is
+defined. Otherwise, it lives in
\f(CR~/.local/share/remembering/profile\-name\fR.
Each line of the \fIPROFILE\fP contains three pieces of information:
diff --git a/doc/remembering.fr.5.in b/doc/remembering.fr.5.in
index 9395bc4..9ddeb42 100644
--- a/doc/remembering.fr.5.in
+++ b/doc/remembering.fr.5.in
@@ -13,8 +13,9 @@ remembering \- format of the \fIPROFILE\fP text file.
.SH PROFILE
-The \fIPROFILE\fP is a text file, stored on \f(CR$XDG_DATA_HOME/profile\-name\fR
-if \f(CR$XDG_DATA_HOME\fR is defined. Otherwise, it lives in
+The \fIPROFILE\fP is a text file, stored on
+\f(CR$XDG_DATA_HOME/remembering/profile\-name\fR if \f(CR$XDG_DATA_HOME\fR is
+defined. Otherwise, it lives in
\f(CR~/.local/share/remembering/profile\-name\fR.
Each line of the \fIPROFILE\fP contains three pieces of information:
diff --git a/doc/remembering.pt.5.in b/doc/remembering.pt.5.in
index 77d2a99..c37c893 100644
--- a/doc/remembering.pt.5.in
+++ b/doc/remembering.pt.5.in
@@ -13,8 +13,9 @@ remembering \- format of the \fIPROFILE\fP text file.
.SH PROFILE
-The \fIPROFILE\fP is a text file, stored on \f(CR$XDG_DATA_HOME/profile\-name\fR
-if \f(CR$XDG_DATA_HOME\fR is defined. Otherwise, it lives in
+The \fIPROFILE\fP is a text file, stored on
+\f(CR$XDG_DATA_HOME/remembering/profile\-name\fR if \f(CR$XDG_DATA_HOME\fR is
+defined. Otherwise, it lives in
\f(CR~/.local/share/remembering/profile\-name\fR.
Each line of the \fIPROFILE\fP contains three pieces of information:
diff --git a/po/LC_MESSAGES/CHANGELOG.en.md/eo.po b/po/LC_MESSAGES/CHANGELOG.en.md/eo.po
index 6d33e5a..0e3eb5b 100644
--- a/po/LC_MESSAGES/CHANGELOG.en.md/eo.po
+++ b/po/LC_MESSAGES/CHANGELOG.en.md/eo.po
@@ -62,3 +62,27 @@ msgstr ""
msgid "Initial public release."
msgstr ""
+
+msgid "Use of `$XDG_DATA_HOME`"
+msgstr ""
+
+msgid ""
+"When the environment variable `$XDG_DATA_HOME` is defined, remembering now "
+"appends a trailing `/remembering` to it instead of start writing files to "
+"where the environment variable points to."
+msgstr ""
+
+msgid ""
+"This is in conformance with the [XDG Base Directory Specification][xdg]."
+msgstr ""
+
+msgid "Exit code"
+msgstr ""
+
+#, fuzzy
+msgid ""
+"[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-"
+"latest.html"
+msgstr ""
+"[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-"
+"latest.html"
diff --git a/po/LC_MESSAGES/CHANGELOG.en.md/fr.po b/po/LC_MESSAGES/CHANGELOG.en.md/fr.po
index 6d33e5a..0e3eb5b 100644
--- a/po/LC_MESSAGES/CHANGELOG.en.md/fr.po
+++ b/po/LC_MESSAGES/CHANGELOG.en.md/fr.po
@@ -62,3 +62,27 @@ msgstr ""
msgid "Initial public release."
msgstr ""
+
+msgid "Use of `$XDG_DATA_HOME`"
+msgstr ""
+
+msgid ""
+"When the environment variable `$XDG_DATA_HOME` is defined, remembering now "
+"appends a trailing `/remembering` to it instead of start writing files to "
+"where the environment variable points to."
+msgstr ""
+
+msgid ""
+"This is in conformance with the [XDG Base Directory Specification][xdg]."
+msgstr ""
+
+msgid "Exit code"
+msgstr ""
+
+#, fuzzy
+msgid ""
+"[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-"
+"latest.html"
+msgstr ""
+"[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-"
+"latest.html"
diff --git a/po/LC_MESSAGES/CHANGELOG.en.md/pt.po b/po/LC_MESSAGES/CHANGELOG.en.md/pt.po
index 6d33e5a..0e3eb5b 100644
--- a/po/LC_MESSAGES/CHANGELOG.en.md/pt.po
+++ b/po/LC_MESSAGES/CHANGELOG.en.md/pt.po
@@ -62,3 +62,27 @@ msgstr ""
msgid "Initial public release."
msgstr ""
+
+msgid "Use of `$XDG_DATA_HOME`"
+msgstr ""
+
+msgid ""
+"When the environment variable `$XDG_DATA_HOME` is defined, remembering now "
+"appends a trailing `/remembering` to it instead of start writing files to "
+"where the environment variable points to."
+msgstr ""
+
+msgid ""
+"This is in conformance with the [XDG Base Directory Specification][xdg]."
+msgstr ""
+
+msgid "Exit code"
+msgstr ""
+
+#, fuzzy
+msgid ""
+"[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-"
+"latest.html"
+msgstr ""
+"[xdg]: https://specifications.freedesktop.org/basedir-spec/basedir-spec-"
+"latest.html"
diff --git a/po/LC_MESSAGES/doc/remembering.en.5.in/eo.po b/po/LC_MESSAGES/doc/remembering.en.5.in/eo.po
index a84c974..0bb9ee1 100644
--- a/po/LC_MESSAGES/doc/remembering.en.5.in/eo.po
+++ b/po/LC_MESSAGES/doc/remembering.en.5.in/eo.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2021-09-02 12:41-0300\n"
+"POT-Creation-Date: 2021-09-08 07:30-0300\n"
"PO-Revision-Date: 2021-09-02 12:41-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -56,9 +56,9 @@ msgstr ""
#. type: Plain text
#: doc/remembering.en.5.in:13
msgid ""
-"The I<PROFILE> is a text file, stored on \\f(CR$XDG_DATA_HOME/profile-name"
-"\\fR if \\f(CR$XDG_DATA_HOME\\fR is defined. Otherwise, it lives in "
-"\\f(CR~/.local/share/remembering/profile-name\\fR."
+"The I<PROFILE> is a text file, stored on \\f(CR$XDG_DATA_HOME/remembering/"
+"profile-name\\fR if \\f(CR$XDG_DATA_HOME\\fR is defined. Otherwise, it "
+"lives in \\f(CR~/.local/share/remembering/profile-name\\fR."
msgstr ""
#. type: Plain text
diff --git a/po/LC_MESSAGES/doc/remembering.en.5.in/fr.po b/po/LC_MESSAGES/doc/remembering.en.5.in/fr.po
index b95cc07..dac6946 100644
--- a/po/LC_MESSAGES/doc/remembering.en.5.in/fr.po
+++ b/po/LC_MESSAGES/doc/remembering.en.5.in/fr.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2021-09-02 12:41-0300\n"
+"POT-Creation-Date: 2021-09-08 07:30-0300\n"
"PO-Revision-Date: 2021-09-02 12:41-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -55,9 +55,9 @@ msgstr ""
#. type: Plain text
#: doc/remembering.en.5.in:13
msgid ""
-"The I<PROFILE> is a text file, stored on \\f(CR$XDG_DATA_HOME/profile-name"
-"\\fR if \\f(CR$XDG_DATA_HOME\\fR is defined. Otherwise, it lives in "
-"\\f(CR~/.local/share/remembering/profile-name\\fR."
+"The I<PROFILE> is a text file, stored on \\f(CR$XDG_DATA_HOME/remembering/"
+"profile-name\\fR if \\f(CR$XDG_DATA_HOME\\fR is defined. Otherwise, it "
+"lives in \\f(CR~/.local/share/remembering/profile-name\\fR."
msgstr ""
#. type: Plain text
diff --git a/po/LC_MESSAGES/doc/remembering.en.5.in/pt.po b/po/LC_MESSAGES/doc/remembering.en.5.in/pt.po
index 6448715..f75496a 100644
--- a/po/LC_MESSAGES/doc/remembering.en.5.in/pt.po
+++ b/po/LC_MESSAGES/doc/remembering.en.5.in/pt.po
@@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
-"POT-Creation-Date: 2021-09-02 12:41-0300\n"
+"POT-Creation-Date: 2021-09-08 07:30-0300\n"
"PO-Revision-Date: 2021-09-02 12:41-0300\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -55,9 +55,9 @@ msgstr ""
#. type: Plain text
#: doc/remembering.en.5.in:13
msgid ""
-"The I<PROFILE> is a text file, stored on \\f(CR$XDG_DATA_HOME/profile-name"
-"\\fR if \\f(CR$XDG_DATA_HOME\\fR is defined. Otherwise, it lives in "
-"\\f(CR~/.local/share/remembering/profile-name\\fR."
+"The I<PROFILE> is a text file, stored on \\f(CR$XDG_DATA_HOME/remembering/"
+"profile-name\\fR if \\f(CR$XDG_DATA_HOME\\fR is defined. Otherwise, it "
+"lives in \\f(CR~/.local/share/remembering/profile-name\\fR."
msgstr ""
#. type: Plain text
diff --git a/src/remembering.in b/src/remembering.in
index 6e7bfa8..bdf0e37 100755
--- a/src/remembering.in
+++ b/src/remembering.in
@@ -84,7 +84,7 @@ if [ -z "$PROFILEFLAG" ]; then
fi
COMMAND="$COMMANDFLAG"
-PROFILE="${XDG_DATA_HOME:-$HOME/.local/share/remembering}/$PROFILEFLAG"
+PROFILE="${XDG_DATA_HOME:-$HOME/.local/share}/remembering/$PROFILEFLAG"
if [ ! -e "$PROFILE" ]; then
mkdir -p "$(dirname "$PROFILE")"
diff --git a/tests/cli-opts.sh b/tests/cli-opts.sh
index 48020e2..733636f 100755
--- a/tests/cli-opts.sh
+++ b/tests/cli-opts.sh
@@ -182,7 +182,7 @@ test_environment_variables_and_precedence() {
assert_status 0
assert_empty_stderr
assert_stdout 'a'
- assert_stream "\$XDG PROFILE" "$XDG/$PROFILE" '1:a'
+ assert_stream "\$XDG PROFILE" "$XDG/remembering/$PROFILE" '1:a'
N="$LINENO"
OUT="$(mktemp)"
@@ -215,7 +215,8 @@ test_environment_variables_and_precedence() {
assert_status 0
assert_empty_stderr
assert_stdout 'c'
- assert_stream "\$XDG and \$HOME PROFILE" "$XDG/$PROFILE" '1:c'
+ assert_stream \
+ "\$XDG and \$HOME PROFILE" "$XDG/remembering/$PROFILE" '1:c'
if [ -e "$HHOME/.local/share/remembering/$PROFILE" ]; then
printf "\nERR: The file in \$HHOME/.local should't exist\n" >&2
diff --git a/tests/ranking.sh b/tests/ranking.sh
index e07c594..6649156 100755
--- a/tests/ranking.sh
+++ b/tests/ranking.sh
@@ -67,9 +67,9 @@ BASE_PROFILE_A_PICKED='1:a
0:d
0:e'
assert_profile() {
- if [ "$(cat "$XDG_DATA_HOME/$1")" != "$2" ]; then
+ if [ "$(cat "$XDG_DATA_HOME/remembering/$1")" != "$2" ]; then
printf '\n%s: Bad profile merge (%s).\n\nExpected:\n%s\nGot\n%s\n' \
- "$(ERROR)" "$PROFILE" "$2" "$(cat "$XDG_DATA_HOME/$1")" >&2
+ "$(ERROR)" "$PROFILE" "$2" "$(cat "$XDG_DATA_HOME/remembering/$1")" >&2
exit 1
fi
}
@@ -188,7 +188,7 @@ test_pick_inexisting_value() {
0:b
0:c
0:d
-0:e' > "$XDG_DATA_HOME/$PROFILE"
+0:e' > "$XDG_DATA_HOME/remembering/$PROFILE"
INPUT='a
b
c
@@ -219,7 +219,7 @@ test_stdin_profile_merging() {
echo '0:a
0:b
0:c
-0:z' > "$XDG_DATA_HOME/$PROFILE"
+0:z' > "$XDG_DATA_HOME/remembering/$PROFILE"
INPUT='a
b
c
@@ -237,7 +237,7 @@ e'
test_stdin_is_larger_than_profile() {
testing 'STDIN is larger than profile'
PROFILE="stdin-is-larger-than-profile-$(uuid)"
- echo '0:a' > "$XDG_DATA_HOME/$PROFILE"
+ echo '0:a' > "$XDG_DATA_HOME/remembering/$PROFILE"
INPUT='a
b
c
@@ -251,7 +251,7 @@ e'
test_stdin_is_smaller_than_profile() {
testing 'STDIN is smaller than profile'
PROFILE="stdin-is-smaller-than-profile-$(uuid)"
- echo "$BASE_PROFILE" > "$XDG_DATA_HOME/$PROFILE"
+ echo "$BASE_PROFILE" > "$XDG_DATA_HOME/remembering/$PROFILE"
INPUT='a'
pick_x a "$INPUT"
assert_profile "$PROFILE" "$BASE_PROFILE_A_PICKED"
@@ -261,7 +261,7 @@ test_stdin_is_smaller_than_profile() {
test_stdin_is_empty() {
testing 'STDIN is empty'
PROFILE="stdin-is-empty-$(uuid)"
- echo "$BASE_PROFILE" > "$XDG_DATA_HOME/$PROFILE"
+ echo "$BASE_PROFILE" > "$XDG_DATA_HOME/remembering/$PROFILE"
OUT="$(mktemp)"
ERR="$(mktemp)"
@@ -294,7 +294,7 @@ e'
test_profile_is_empty() {
testing 'profile is empty'
PROFILE="profile-is-empty-$(uuid)"
- printf '' > "$XDG_DATA_HOME/$PROFILE"
+ printf '' > "$XDG_DATA_HOME/remembering/$PROFILE"
INPUT='a
b
c