Skip to content

Commit

Permalink
fix: add support for typographic quotes in schedule (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvymazal authored Sep 25, 2024
1 parent 110fe00 commit 8bd9a35
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dienstplan/commands.clj
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ Caveats:
(defn parse-args-schedule-cmd
[command-parsed]
(let [args (get-command-args command-parsed)
matcher (re-matcher regex-schedule args)
args' (string/replace args #"[\u201C\u201D\u00AB\u00BB\u201E\u201F\u2039\u203A\u275D\u275E]" "\"")
matcher (re-matcher regex-schedule args')
result (when (.matches matcher)
{:subcommand (.group matcher "subcommand")
:executable (.group matcher "executable")
Expand Down
25 changes: 25 additions & 0 deletions test/dienstplan/commands_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,31 @@
:executable "rotate my-rota"
:crontab "9 0 * * Mon-Fri"}
"Schedule create"]
["<@U02HXENLLPN> schedule create \u201Crotate my-rota\u201D 9 0 * * Mon-Fri"
{:subcommand "create"
:executable "rotate my-rota"
:crontab "9 0 * * Mon-Fri"}
"Schedule create with typographic quotes i"]
["<@U02HXENLLPN> schedule create \u00ABrotate my-rota\u00BB 9 0 * * Mon-Fri"
{:subcommand "create"
:executable "rotate my-rota"
:crontab "9 0 * * Mon-Fri"}
"Schedule create with typographic quotes ii"]
["<@U02HXENLLPN> schedule create \u201Erotate my-rota\u201F 9 0 * * Mon-Fri"
{:subcommand "create"
:executable "rotate my-rota"
:crontab "9 0 * * Mon-Fri"}
"Schedule create with typographic quotes iii"]
["<@U02HXENLLPN> schedule create \u2039rotate my-rota\u203A 9 0 * * Mon-Fri"
{:subcommand "create"
:executable "rotate my-rota"
:crontab "9 0 * * Mon-Fri"}
"Schedule create with typographic quotes iv"]
["<@U02HXENLLPN> schedule create \u275Drotate my-rota\u275E 9 0 * * Mon-Fri"
{:subcommand "create"
:executable "rotate my-rota"
:crontab "9 0 * * Mon-Fri"}
"Schedule create with typographic quotes v"]
["<@U02HXENLLPN> schedule delete \"rotate my-rota\""
{:subcommand "delete"
:executable "rotate my-rota"
Expand Down

0 comments on commit 8bd9a35

Please sign in to comment.