-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from smeech/main
New version of calc-macos
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# espanso-calc-macos | ||
Basic calculation package for espanso that works in macOS. | ||
|
||
## Example | ||
|
||
![Screen Recording 2022-06-23 at 10 13 21](https://user-images.githubusercontent.com/23709916/175312182-e6372ce2-b296-4d5b-bdc0-a9d8543ab85e.gif) | ||
|
||
## Usage | ||
1. Type `:calc` | ||
2. You'll see a form, type the calculation | ||
<img width="185" alt="image" src="https://user-images.githubusercontent.com/23709916/175305102-2453d39b-b7d8-45f2-8a42-9286a2ab2d25.png"></img> | ||
3. The text will be replaced with the result | ||
|
||
## Commands | ||
|
||
| Command | Match | Example | Result | | ||
|----------------------------|--------|---------------|------------| | ||
| Calculate | :calc | Input: 10 - 3 | 7 | | ||
| Calculate and show account | :ecalc | Input: 10 - 3 | 10 - 3 = 7 | | ||
|
||
## Implementation | ||
|
||
This package uses `bc` to do the calculations | ||
``` | ||
echo '10 * 4' | bc | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: "calc-macos" | ||
title: "Calc Macos" | ||
description: Espanso package for doing basic arithmetic in the shell. | ||
version: 0.1.1 | ||
author: Tashima42 | ||
tags: ["utility", "math", "calculator"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Calculator | ||
|
||
name: calc-macos | ||
parent: default | ||
|
||
matches: | ||
# Calculator | ||
- trigger: ":calc" | ||
replace: "{{solved}}" | ||
vars: | ||
- name: "input" | ||
type: "form" | ||
params: | ||
layout: | | ||
[[val]] | ||
- name: "solved" | ||
type: shell | ||
params: | ||
cmd: "echo '{{input.val}}' | bc" | ||
# Calculator w/ input | ||
- trigger: ":ecalc" | ||
replace: "{{input.val}} = {{solved}}" | ||
vars: | ||
- name: "input" | ||
type: "form" | ||
params: | ||
layout: | | ||
[[val]] | ||
- name: "solved" | ||
type: shell | ||
params: | ||
cmd: "echo '{{input.val}}' | bc" |