diff --git a/BUILTINS.md b/BUILTINS.md index 79af313..3b5add7 100644 --- a/BUILTINS.md +++ b/BUILTINS.md @@ -19,12 +19,14 @@ This a list of built-in whop commands. | Build SHA1 (tr, sha1sum) | - | | Build SHA256 (tr, sha256sum) | - | | Build SHA512 (tr, sha512sum) | - | -| Reverse (rev) | - | +| Reverse each line (rev) | - | +| Reverse the order of lines (tac) | - | | 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) | - | +| Remove blank/empty lines (grep) | - | +| Remove blank/empty lines with spaces only (grep) | - | +| Remove blank/empty lines (rg) | - | +| Remove blank/empty lines with spaces only (rg) | - | +| Remove blank/empty lines (vim) | - | | Join lines with comma (vim) | - | | Wrap numbers with single quotes (vim) | - | | Wrap numbers with double quotes (vim) | - | @@ -38,9 +40,9 @@ This a list of built-in whop commands. | 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 | - | +| PowerShell escape characters to Unix (vim) | - | +| Change single quotes to double quotes (vim) | - | +| Change double quotes to single quotes (vim) | - | | snake_case to CamelCase (python) | - | | CamelCase to snake_case (python) | - | | snake_case to kebab-case (python) | - | @@ -50,3 +52,5 @@ This a list of built-in whop commands. | Generate UUID4 (python) | - | | Unix timestamp to ISO formatted datetime (python) | - | | ISO formatted datetime to Unix timestamp (python) | - | +| Shuffle lines (shuf) | - | +| Sort JSON keys (jq) | - | diff --git a/CHANGELOG.md b/CHANGELOG.md index 959bfb1..0db5089 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 2024-08-13 - v1.3.0 + +- Add more builtin commands: + - Remove blank/empty lines (vim) + - Reverse the order of lines (tac) + - Shuffle lines (shuf) + - Sort JSON keys (jq) +- Rename `Reverse (rev)` to `Reverse each line (rev)` +- Add `blank/empty` to several commands related to removal of blank lines for ease of searching +- Add missing `(vim)` suffix to couple of commands + ## 2024-07-10 - v1.2.0 - Add three more builtin commands: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 961429f..cea9d05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,11 +11,9 @@ Here is a list of things you can do right now to improve this package: - propose a solution for text-based commands arguments Here is a list of ideas for builtin commands: -- Sort json - Markdown quote - Count characters (view only) - Count words (view only) -- Shuffle lines - JSON to Query String - JSON to YAML - Lorem ipsum diff --git a/lua/whop/builtin.lua b/lua/whop/builtin.lua index 2875d1d..83af491 100644 --- a/lua/whop/builtin.lua +++ b/lua/whop/builtin.lua @@ -64,29 +64,37 @@ M.commands = { cmd = [[%!tr -d '\n' | sha512sum]], }, { - name = "[builtin] Reverse (rev)", + name = "[builtin] Reverse each line (rev)", cmd = [[%!rev]], }, + { + name = "[builtin] Reverse the order of lines (tac)", + cmd = [[%!tac]], + }, { name = "[builtin] Remove all whitespace (tr)", cmd = [[%!tr -d "[:space:]"]], }, { - name = "[builtin] Remove blank lines (grep)", + name = "[builtin] Remove blank/empty lines (grep)", cmd = [[%!grep .]], }, { - name = "[builtin] Remove blank lines with spaces only (grep)", + name = "[builtin] Remove blank/empty lines with spaces only (grep)", cmd = [[%!grep "\S"]], }, { - name = "[builtin] Remove blank lines (rg)", + name = "[builtin] Remove blank/empty lines (rg)", cmd = [[%!rg -N .]], }, { - name = "[builtin] Remove blank lines with spaces only (rg)", + name = "[builtin] Remove blank/empty lines with spaces only (rg)", cmd = [[%!rg -N "\S"]], }, + { + name = "[builtin] Remove blank/empty lines (vim)", + cmd = [[%s/\s*\n//]], + }, { name = "[builtin] Join lines with comma (vim)", cmd = [[%s/\n/,/]], @@ -140,18 +148,18 @@ M.commands = { cmd = [[%!ansible-vault decrypt]], }, { - name = "[builtin] PowerShell escape characters to Unix", + name = "[builtin] PowerShell escape characters to Unix (vim)", cmd = function() vim.cmd([[%s/\^$/\\/]]) vim.cmd([[%s/\^\\\^/\\/g]]) end, }, { - name = "[builtin] Change single quotes to double quotes", + name = "[builtin] Change single quotes to double quotes (vim)", cmd = [[%s/'/"/g]], }, { - name = "[builtin] Change double quotes to single quotes", + name = "[builtin] Change double quotes to single quotes (vim)", cmd = [[%s/"/'/g]], }, { @@ -190,6 +198,14 @@ M.commands = { 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()))']], }, + { + name = "[builtin] Shuffle lines (shuf)", + cmd = [[%!shuf]], + }, + { + name = "[builtin] Sort JSON keys (jq)", + cmd = [[%!jq --sort-keys]], + }, } return M