Skip to content

Commit

Permalink
Merge pull request #119 from smeech/main
Browse files Browse the repository at this point in the history
New version of calc-macos
  • Loading branch information
smeech authored Jun 30, 2024
2 parents b958686 + 487e279 commit ea00a3b
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/calc-macos/0.1.1/README.md
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
```
6 changes: 6 additions & 0 deletions packages/calc-macos/0.1.1/_manifest.yml
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"]
32 changes: 32 additions & 0 deletions packages/calc-macos/0.1.1/package.yml
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"

0 comments on commit ea00a3b

Please sign in to comment.