Comments (5)
This will replace the join / wrapping strings items in preferences.
I will need to define:
- How to adding user-defined functions to CutBox. _MVP: add functions via
~/.cutbox.js
from cutbox.
Initial push of this feature will be released in 1.1.0 today.
Documentation is still TODO, basic usage as below:
- Items you've selected will be in the Javascript environment as
items
(if you only select one item will still be initems
) - Cutbox will evaluate the Javascript and fetch the value of
paste
Anything you do in between is up to you.
To trigger a paste which uses your javascript use: Cmd + Enter
For now, everything needs to be available in ~/.cutbox.js
I've considered adding useful libs (i.e. LoDash), but I think it's better if you just build a single file for the moment, and JS has a lot built in for filtering arrays etc. So maybe, maybe not.
More important will be allowing you to do things that give you a way of selecting one of many actions that you've scripted. The keyboard interaction part is the way I'd use it, but giving people a programmable GUI menu / HUD etc. would be a nice way to make it user friendly.
I'm rambling.
from cutbox.
Quick examples
Pressing Cmd + Enter to process with JS and paste:
Assuming: items |
---|
Lorem ipsum |
Dolor sit amet |
Bob the goat |
var mapped = items.map((e) => `<p>${e}</p>`)
var paste = `<div>${mapped.join("\n")}</div>`
<div><p>Lorem ipsum</p>
<p>Dolor sit amet</p>
<p>Bob the goat</p></div>
More examples:
Transform text pasted to uppercase
var paste = this.items.map((e) => e.toUpperCase() ).join("\n");
LOREM IPSUM
DOLOR SIT AMET
BOB THE GOAT
Transform text pasted to lowercase
var paste = this.items.map((e) => e.toLowerCase() ).join("\n");
lorem ipsum
dolor sit amet
bob the goat
from cutbox.
At this point, I don't think this is a particularly useful feature, but I wanted to open it up as soon as possible for people to use, so I can get feedback if any is coming, and to get an idea of the way people want to use this.
For myself, it would be useful to be able to define a number of different transformers that I can choose from when I do Cmd + Enter
Showing a secondary popup with a list of actions available, would be relatively easy to deliver and I can iterate on that based on how I use it, or other user feedback.
from cutbox.
1.1.0 is released.
from cutbox.
Related Issues (20)
- Clear History additional settings HOT 1
- Localize for Japanese, Korean, Thai HOT 1
- Release 1.5.8
- JS REPL : help command does not work
- Feature: Toggle time filter with CMD+h HOT 1
- When selecting Javascript preferences, focus the command line input. HOT 1
- DEV Bug 1.5.9: Items filtered by "none" are not selected from the store correctly. HOT 4
- Feature: Time filter keyword `none` HOT 1
- Feature: Reset time on selected item(s) HOT 1
- Feature/Improvement: Time filter keyboard accessibility HOT 1
- Automatic update of store items missing timestamps on startup ≥ 1.6.0 HOT 3
- When Cmd-h is pressed, if a time limit was previously set, toggling on will reinstate the time limit HOT 1
- String matching - match a literal string
- CLI substring exact match
- CLI invalid options should return an error message on stderr
- Bug: String exact match mode missing from status menu HOT 1
- Docs mentioning ~/.cutbox.js must also mention need for `this.cutboxFunctions` HOT 1
- In JS shellCommand should allow stdin & stderr handling HOT 1
- Create a coverage graph HOT 1
- Esc in Paste Pipeline returns to Search View HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cutbox.