diff --git a/.gitignore b/.gitignore index 0d20b64..ece32b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,28 @@ +# Common +*.bak +ignore/ + +# OS Junk Files +Thumbs.db +Desktop.in +.DS_Store +__MACOSX/ + +# IDE Stuff +*.sublime-workspace +.idea/ +.phpintel/ +.vscode/ + +# Package Management +node_modules/ + +# Logs +*.log + +# Private Files & Folders +private/ +icons/ + +# Compiled *.pyc diff --git a/Change Case.alfredworkflow b/Change Case.alfredworkflow index 3891488..63faa9b 100644 Binary files a/Change Case.alfredworkflow and b/Change Case.alfredworkflow differ diff --git a/README.md b/README.md index 7184805..001c885 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,24 @@ # Change Case — Workflow for Alfred -Changes the case of text on the clipboard to uppercase, lowercase, or title case. +Changes the case of text selected, provided, or on the clipboard to UPPERCASE, lowercase, Title Case, CamelCase, kebab-case, or snake_case. -[Download the workflow](https://github.com/gillibrand/alfred-change-case/raw/master/Change%20Case.alfredworkflow). +[Download the workflow](https://github.com/gillibrand/alfred-change-case/blob/master/Change%20Case.alfredworkflow). ![Screenshot](changecase.png) ## Usage -Change the case of text on the keyboard with the keyword `case`. All three styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application. +Change the case of text on the keyboard with the keyword `case`. All six styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application. -Optionally, any text typed after `case` will be changed instead of the clipboard. +Optionally, any text typed after `case` will be changed instead of the clipboard. ## Version History +### 9/9/2018 + +- Added CamelCase, kebab-case, and snake_case options +- Added additional keywords "tt" and "transform" + ### 4/19/2013 - Always sorts the case styles in the same order now: lowercase, uppercase, then title case. (Removed the `uid` from results returned to Alfred as supported in Alfred 2.0.3.) @@ -25,4 +30,5 @@ Optionally, any text typed after `case` will be changed instead of the clipboard ## Credits - Workflow by Jay Gillibrand. -- `titlecase` module by [Stuart Colville](http://muffinresearch.co.uk). \ No newline at end of file +- `titlecase` module by [Stuart Colville](http://muffinresearch.co.uk). +- `CamelCase`, `kebab-case`, and `snake_case` additions added by [Ben Wagner](https://blizzrdof77.com) diff --git a/camelcase.png b/camelcase.png new file mode 100644 index 0000000..8046725 Binary files /dev/null and b/camelcase.png differ diff --git a/changecase.png b/changecase.png index 49bb91a..9ef15b7 100644 Binary files a/changecase.png and b/changecase.png differ diff --git a/changecase.py b/changecase.py index 78246fe..8393e92 100644 --- a/changecase.py +++ b/changecase.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# +# import re, sys from xml.sax.saxutils import escape from titlecase import titlecase @@ -29,19 +29,23 @@ def upcase(m): variations = { 'lower': escape(text.lower(), {'"': '"', '\n': ' '} ), 'upper': escape(text.upper(), {'"': '"', '\n': ' '} ), - 'title': escape(titlecase_plus(text), {'"': '"', '\n': ' '} ) + 'title': escape(titlecase_plus(text), {'"': '"', '\n': ' '} ), + 'camel': escape(titlecase_plus(text), {'"': '"', '\n': ' '} ).replace(' ', ''), + 'kebab': escape(text.lower(), {'"': '"', '\n': ' '} ).replace(' ', '-').replace('_', '-'), + 'snake': escape(text.lower(), {'"': '"', '\n': ' '} ).replace(' ', '_').replace('-', '_') + } print """ %(lower)s - Lowercase + lowercase lowercase.png %(upper)s - Uppercase + UPPERCASE uppercase.png @@ -49,4 +53,20 @@ def upcase(m): Title Case titlecase.png + + %(camel)s + CamelCase + camelcase.png + + + %(kebab)s + kebab-case + kebabcase.png + + + %(snake)s + snake_case + snakecase.png + + """ % variations diff --git a/icon.png b/icon.png index 46e42ec..8a3883c 100644 Binary files a/icon.png and b/icon.png differ diff --git a/icons.acorn b/icons.acorn index f3041c5..26e92f8 100644 Binary files a/icons.acorn and b/icons.acorn differ diff --git a/info.plist b/info.plist index cb5049f..1f180c7 100644 --- a/info.plist +++ b/info.plist @@ -4,9 +4,11 @@ bundleid gillibrand.jay.changecase + category + Tools connections - 120913BE-7A34-4EA4-A8A1-BDCE5F034458 + 272A1B72-8F54-4B5F-831A-8787D7264102 destinationuid @@ -15,17 +17,34 @@ 0 modifiersubtext + vitoclose + + + + B6600E5C-BB57-4054-827B-5688E776AEE7 + + + destinationuid + 48FA1057-4D68-48B5-BB44-CBC28130A414 + modifiers + 0 + modifiersubtext + + vitoclose + - 3EEC7A2D-486C-4756-A271-FAD9448441C8 + CCBE2CE0-D301-463D-A9DC-36C98D2A7030 destinationuid - 120913BE-7A34-4EA4-A8A1-BDCE5F034458 + 48FA1057-4D68-48B5-BB44-CBC28130A414 modifiers 0 modifiersubtext + vitoclose + @@ -42,25 +61,96 @@ config - action + alfredfiltersresults + + alfredfiltersresultsmatchmode + 0 + argumenttrimmode + 0 + argumenttype + 1 + escaping + 62 + keyword + tt + queuedelaycustom + 1 + queuedelayimmediatelyinitially + + queuedelaymode + 0 + queuemode + 1 + runningsubtext + transforming text case... + script + pbpaste | python changecase.py "{query}" + scriptargtype + 0 + scriptfile + + subtext + Change the case to upper, lower, title, camel, kebab, or snake case. + title + Change/Transform Text Case + type + 0 + withspace + + + type + alfred.workflow.input.scriptfilter + uid + CCBE2CE0-D301-463D-A9DC-36C98D2A7030 + version + 2 + + + config + + alfredfiltersresults + + alfredfiltersresultsmatchmode 0 - argument + argumenttrimmode + 0 + argumenttype + 1 + escaping + 62 + keyword + case + queuedelaycustom 1 - hotkey - 8 - hotmod - 393216 - hotstring - C - leftcursor + queuedelayimmediatelyinitially - modsmode + queuedelaymode + 0 + queuemode + 1 + runningsubtext + transforming text case... + script + pbpaste | python changecase.py "{query}" + scriptargtype + 0 + scriptfile + + subtext + Change the case to upper, lower, title, camel, kebab, or snake case... + title + Change/Transform Text Case + type 0 + withspace + type - alfred.workflow.trigger.hotkey + alfred.workflow.input.scriptfilter uid - 3EEC7A2D-486C-4756-A271-FAD9448441C8 + B6600E5C-BB57-4054-827B-5688E776AEE7 + version + 2 config @@ -69,27 +159,51 @@ clipboardtext {query} + transient + type alfred.workflow.output.clipboard uid 48FA1057-4D68-48B5-BB44-CBC28130A414 + version + 2 config + alfredfiltersresults + + alfredfiltersresultsmatchmode + 0 + argumenttrimmode + 0 argumenttype 1 escaping 62 keyword - case + transform + queuedelaycustom + 1 + queuedelayimmediatelyinitially + + queuedelaymode + 0 + queuemode + 1 + runningsubtext + transforming text case... script pbpaste | python changecase.py "{query}" + scriptargtype + 0 + scriptfile + subtext - Change the case of text on the clipboard + Change the case to upper, lower, title, camel, kebab, or snake case... title - Change Case + Change/Transform Text Case type 0 withspace @@ -98,31 +212,48 @@ type alfred.workflow.input.scriptfilter uid - 120913BE-7A34-4EA4-A8A1-BDCE5F034458 + 272A1B72-8F54-4B5F-831A-8787D7264102 + version + 2 readme - Change the case of text on the keyboard with the keyword case. All three styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application. + Change the case of text on the keyboard with the keyword case. All styles are previewed as Alfred results. Select one to copy it to the clipboard and paste into in the current application. -Optionally, any text type after case will be changed instead of the clipboard. +Optionally, any text typed after `case` will be changed instead of the clipboard. uidata - 120913BE-7A34-4EA4-A8A1-BDCE5F034458 + 272A1B72-8F54-4B5F-831A-8787D7264102 + xpos + 440 ypos - 130 + 330 - 3EEC7A2D-486C-4756-A271-FAD9448441C8 + 48FA1057-4D68-48B5-BB44-CBC28130A414 + xpos + 710 ypos - 130 + 220 - 48FA1057-4D68-48B5-BB44-CBC28130A414 + B6600E5C-BB57-4054-827B-5688E776AEE7 + + xpos + 440 + ypos + 220 + + CCBE2CE0-D301-463D-A9DC-36C98D2A7030 + xpos + 440 ypos - 130 + 110 + version + 1.1 webaddress https://github.com/gillibrand/alfred-change-case diff --git a/kebabcase.png b/kebabcase.png new file mode 100644 index 0000000..ec4ae6f Binary files /dev/null and b/kebabcase.png differ diff --git a/lowercase.png b/lowercase.png index b63e7a0..e87d4f0 100644 Binary files a/lowercase.png and b/lowercase.png differ diff --git a/snakecase.png b/snakecase.png new file mode 100644 index 0000000..4cc0d7c Binary files /dev/null and b/snakecase.png differ diff --git a/titlecase.png b/titlecase.png index 9d78df8..c0eba4a 100644 Binary files a/titlecase.png and b/titlecase.png differ diff --git a/uppercase.png b/uppercase.png index 33711f5..4ed8b53 100644 Binary files a/uppercase.png and b/uppercase.png differ