bundleid connections 33E97B3C-AE75-4802-9866-EA166186A359 destinationuid A729B274-0D6A-474B-BC29-B189FFA5B80C modifiers 0 modifiersubtext vitoclose 599BE109-55D2-4883-A734-7346A8DBEDFF destinationuid F69BFB49-6D5A-43CE-A2ED-3D2E5C2D69B0 modifiers 0 modifiersubtext vitoclose 60275CD9-3162-4313-A14C-77BED33791E4 A729B274-0D6A-474B-BC29-B189FFA5B80C destinationuid B3D61B44-CE57-409D-B7D2-5DA8CB15583B modifiers 0 modifiersubtext vitoclose B3D61B44-CE57-409D-B7D2-5DA8CB15583B destinationuid 599BE109-55D2-4883-A734-7346A8DBEDFF modifiers 0 modifiersubtext vitoclose createdby Timmy description disabled name 使用Prettier自動格式化程式碼 objects config concurrently escaping 102 script # 定義預設的配置設定 SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin TZ='Asia/Taipei' # 將配置設定寫入環境變數 export PATH export LANG=en_US.UTF-8 export LANGUAGE=en_US:en export PATH="/opt/homebrew/bin:$PATH" query=$1 # 將第一個參數存入變數query # echo -n $query # 輸出query變數,不換行 # echo -n $(date) # 輸出當前日期,不換行 pbpaste | prettier --parser "$query" 2>&1 # 將剪貼簿的內容輸入Prettier,使用$query指定的解析器格式化,並將錯誤訊息(stderr)重定向到標準輸出(stdout) scriptargtype 1 scriptfile type 0 type alfred.workflow.action.script uid B3D61B44-CE57-409D-B7D2-5DA8CB15583B version 2 config alfredfiltersresults alfredfiltersresultsmatchmode 0 argumenttreatemptyqueryasnil argumenttrimmode 0 argumenttype 1 escaping 102 keyword prettier queuedelaycustom 3 queuedelayimmediatelyinitially queuedelaymode 0 queuemode 1 runningsubtext script import json import sys data = { "items": [ { "title": "使用Prettier自動格式化Markdown文件", "subtitle": "markdown", "arg": "markdown" }, { "title": "使用Prettier自動格式化HTML程式碼", "subtitle": "html", "arg": "html" }, { "title": "使用Prettier自動格式化CSS程式碼", "subtitle": "css", "arg": "css" }, { "title": "使用Prettier自動格式化YAML文件", "subtitle": "yaml", "arg": "yaml" }, { "title": "使用Prettier自動格式化JSON文件", "subtitle": "json", "arg": "json" } ] } json.dump(data, sys.stdout) scriptargtype 1 scriptfile subtext title 使用Prettier自動格式化程式碼 type 9 withspace type alfred.workflow.input.scriptfilter uid A729B274-0D6A-474B-BC29-B189FFA5B80C version 3 config autopaste clipboardtext {query} ignoredynamicplaceholders transient type alfred.workflow.output.clipboard uid 599BE109-55D2-4883-A734-7346A8DBEDFF version 3 config lastpathcomponent onlyshowifquerypopulated removeextension text ✨ Copy successful! ✨ title 使用Prettier自動格式化程式碼 type alfred.workflow.output.notification uid F69BFB49-6D5A-43CE-A2ED-3D2E5C2D69B0 version 1 config action 0 argument 0 focusedappvariable focusedappvariablename hotkey 0 hotmod 0 hotstring leftcursor modsmode 0 relatedAppsMode 0 type alfred.workflow.trigger.hotkey uid 33E97B3C-AE75-4802-9866-EA166186A359 version 2 config alignment 0 backgroundcolor fadespeed 0 fillmode 0 font System Light ignoredynamicplaceholders largetypetext Copied! textcolor wrapat 50 type alfred.workflow.output.largetype uid 60275CD9-3162-4313-A14C-77BED33791E4 version 3 readme uidata 33E97B3C-AE75-4802-9866-EA166186A359 xpos 30 ypos 170 599BE109-55D2-4883-A734-7346A8DBEDFF xpos 500 ypos 170 60275CD9-3162-4313-A14C-77BED33791E4 xpos 685 ypos 300 A729B274-0D6A-474B-BC29-B189FFA5B80C xpos 185 ypos 170 B3D61B44-CE57-409D-B7D2-5DA8CB15583B xpos 345 ypos 170 F69BFB49-6D5A-43CE-A2ED-3D2E5C2D69B0 xpos 685 ypos 170 userconfigurationconfig variablesdontexport version webaddress