Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Espanso clipboard manipulation, new version to select relevant script line using the choice extension id: parameters.
- # Bash version
- - trigger: :case
- label: "Modify and paste copied text"
- replace: "{{output}}"
- vars:
- - name: clipb
- type: clipboard
- - name: script_choice
- type: choice
- params:
- values:
- - label: Uppercase
- id: echo ""{{clipb}}"" | tr [:lower:] [:upper:]
- - label: Lowercase
- id: echo ""{{clipb}}"" | tr [:upper:] [:lower:]
- - label: Initcase
- id: awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1' <<< "{{clipb}}"
- - label: Evaluate equation
- id: awk "BEGIN {print {{clipb}}}"
- - label: Word count
- id: echo "{{clipb}}" ; echo "{{clipb}}" | wc -w
- - name: output
- type: shell
- params:
- shell: bash
- cmd: "{{script_choice}}"
- # pwsh version
- - trigger: :pase
- label: "Modify and paste copied text"
- replace: "{{output}}"
- vars:
- - name: clipb
- type: clipboard
- - name: script_choice
- type: choice
- params:
- values:
- - label: Uppercase
- id: "echo '{{clipb}}' | ForEach-Object { $_.ToUpper() }"
- - label: Lowercase
- id: "echo '{{clipb}}' | ForEach-Object { $_.ToLower() }"
- - label: Initcase
- id: "echo '{{clipb}}' | % { ($_.Split(' ') | ForEach-Object { $_.Substring(0,1).ToUpper() + $_.Substring(1).ToLower() }) -join ' ' }"
- - label: Evaluate equation
- id: "echo '{{clipb}}' | Invoke-Expression"
- - label: Word count
- id: "echo '{{clipb}}' | Measure-Object -Word | Select-Object -ExpandProperty Words"
- - name: output
- type: shell
- params:
- shell: pwsh
- cmd: "{{script_choice}}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement