Age | Commit message (Collapse) | Author |
|
Instead of just responding with the given URL, include a message in
English to let users know that the value was saved.
|
|
I had used `INSERT` as a placeholder while trying to get the plugin
working properly. This would create a row every time the "git remote set
origin" command was invoked. What I really wanted was an upsert.
Looked through a number of different ways of accomplishing that in
SQLite:
- https://stackoverflow.com/questions/418898/sqlite-upsert-not-insert-or-replace/7511635#7511635
- https://stackoverflow.com/questions/15277373/sqlite-upsert-update-or-insert
Ended up settling on this solution from CL.:
https://stackoverflow.com/questions/20323174/upsert-in-sqlite/20326705#20326705
It seemed to be pretty clean and understandable, so I leveraged that
approach.
|
|
Finally figured out how to get a capture group out of the regex match.
Needed to coerce as a two-dimensional `String` list.
Thanks to:
- https://stackoverflow.com/questions/24699279/cant-capture-a-group-in-a-string
- https://stackoverflow.com/questions/6729158/find-all-capturing-groups-of-a-regular-expression
Get the captured group and set it to the URL to insert into the
database. It lives in the second element of the first list:
Prelude Text.Regex.TDFA> "git remote set origin https://example.new" =~ "^git remote set origin ([^ ]+)$" :: [[String]]
[["git remote set origin https://example.new","https://example.new"]]
Prelude Text.Regex.TDFA> "" =~ "^git remote set origin ([^ ]+)$" :: [[String]]
[]
|
|
This plugin provides a command to set a git commit repo URL for use with
the `GitHubCommit` plugin. Typing
git remote set origin URL
in chat will set that URL to the current channel.
Problems:
* Can't figure out how to use capture groups, so the entire matched
message string comes back, not just the URL
* Need to upsert instead of insert into the database
|