Skip to content

Commit

Permalink
Add three more builtin commands
Browse files Browse the repository at this point in the history
- Generate UUID4 (python)
- Unix timestamp to ISO formatted datetime (python)
- ISO formatted datetime to Unix timestamp (python)
  • Loading branch information
biozz committed Jul 9, 2024
1 parent ad6be9c commit 16ab8f4
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 45 deletions.
93 changes: 48 additions & 45 deletions BUILTINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,51 @@

This a list of built-in whop commands.

| Name | Comment |
|---------------------------------------------|---------|
| Base64 Encode (base64) | - |
| Base64 Encode without newlines (tr, base64) | - |
| Base64 Decode (base64) | - |
| Base32 Encode (python) | - |
| Base32 Decode (python) | - |
| Format JSON (jq) | - |
| URL Encode (jq) | - |
| URL Decode (python) | - |
| HTML Decode (python) | - |
| HTML Encode (python) | - |
| Minify JSON (jq) | - |
| Build MD5 (md5) | - |
| Build SHA1 (tr, sha1sum) | - |
| Build SHA256 (tr, sha256sum) | - |
| Build SHA512 (tr, sha512sum) | - |
| Reverse (rev) | - |
| Remove all whitespace (tr) | - |
| Remove blank lines (grep) | - |
| Remove blank lines with spaces only (grep) | - |
| Remove blank lines (rg) | - |
| Remove blank lines with spaces only (rg) | - |
| Join lines with comma (vim) | - |
| Wrap numbers with single quotes (vim) | - |
| Wrap numbers with double quotes (vim) | - |
| Remove single quotes (vim) | - |
| Remove double quotes (vim) | - |
| Remove duplicate lines (vim) | - |
| Remove duplicate lines (sort, uniq) | - |
| Query string to json (python) | - |
| Sum all (awk) | - |
| Python dict to JSON (python) | - |
| Replace commas with newlines (vim) | - |
| Ansible Vault Encrypt (ansible-vault) | - |
| Ansible Vault Decrypt (ansible-vault) | - |
| PowerShell escape characters to Unix | - |
| Change single quotes to double quotes | - |
| Change double quotes to single quotes | - |
| snake_case to CamelCase (python) | - |
| CamelCase to snake_case (python) | - |
| snake_case to kebab-case (python) | - |
| kebab-case to snake_case (python) | - |
| To UPPER case (python) | - |
| To lower case (python) | - |
| Name | Comment |
|---------------------------------------------------|---------|
| Base64 Encode (base64) | - |
| Base64 Encode without newlines (tr, base64) | - |
| Base64 Decode (base64) | - |
| Base32 Encode (python) | - |
| Base32 Decode (python) | - |
| Format JSON (jq) | - |
| URL Encode (jq) | - |
| URL Decode (python) | - |
| HTML Decode (python) | - |
| HTML Encode (python) | - |
| Minify JSON (jq) | - |
| Build MD5 (md5) | - |
| Build SHA1 (tr, sha1sum) | - |
| Build SHA256 (tr, sha256sum) | - |
| Build SHA512 (tr, sha512sum) | - |
| Reverse (rev) | - |
| Remove all whitespace (tr) | - |
| Remove blank lines (grep) | - |
| Remove blank lines with spaces only (grep) | - |
| Remove blank lines (rg) | - |
| Remove blank lines with spaces only (rg) | - |
| Join lines with comma (vim) | - |
| Wrap numbers with single quotes (vim) | - |
| Wrap numbers with double quotes (vim) | - |
| Remove single quotes (vim) | - |
| Remove double quotes (vim) | - |
| Remove duplicate lines (vim) | - |
| Remove duplicate lines (sort, uniq) | - |
| Query string to json (python) | - |
| Sum all (awk) | - |
| Python dict to JSON (python) | - |
| Replace commas with newlines (vim) | - |
| Ansible Vault Encrypt (ansible-vault) | - |
| Ansible Vault Decrypt (ansible-vault) | - |
| PowerShell escape characters to Unix | - |
| Change single quotes to double quotes | - |
| Change double quotes to single quotes | - |
| snake_case to CamelCase (python) | - |
| CamelCase to snake_case (python) | - |
| snake_case to kebab-case (python) | - |
| kebab-case to snake_case (python) | - |
| To UPPER case (python) | - |
| To lower case (python) | - |
| Generate UUID4 (python) | - |
| Unix timestamp to ISO formatted datetime (python) | - |
| ISO formatted datetime to Unix timestamp (python) | - |
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 2024-07-10 - v1.2.0

- Add three more builtin commands:
- Generate UUID4 (python)
- Unix timestamp to ISO formatted datetime (python)
- ISO formatted datetime to Unix timestamp (python)

## 2024-03-03 - v1.1.0

- Add `opts` table to telescope extension to be able to customize the picker
Expand Down
12 changes: 12 additions & 0 deletions lua/whop/builtin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ M.commands = {
name = "[builtin] To lower case (python)",
cmd = [[%!python -c 'import sys; print(sys.stdin.read()[:-1].lower())']],
},
{
name = "[builtin] Generate UUID4 (python)",
cmd = [[%!python -c 'import uuid; print(uuid.uuid4())']],
},
{
name = "[builtin] Unix timestamp to ISO formatted datetime (python)",
cmd = [[%!python -c 'import sys; from datetime import datetime; print(datetime.utcfromtimestamp(int(sys.stdin.read()[:-1])).isoformat())']],
},
{
name = "[builtin] ISO formatted datetime to Unix timestamp (python)",
cmd = [[%!python -c 'import sys; from datetime import datetime; print(int(datetime.fromisoformat(sys.stdin.read()[:-1]).timestamp()))']],
},
}

return M

0 comments on commit 16ab8f4

Please sign in to comment.