-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQuoted-list-single.ini
29 lines (29 loc) · 1015 Bytes
/
Quoted-list-single.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# From https://gist.github.com/DavidPx/fbf8c55009c09621084b267d8c325c70
# These are CopyQ commands I use for copying data out of spreadsheets and into SQL windows.
# single-quoted-list.ini (Quoted-list-single.ini) is good for creating an in clause from a single column of values.
# values-grid.ini (Quoted-list.ini) is good for creating the values section of an insert statement.
# Installing these is quite easy:
#
# 1. Copy the script
# 2. Within Copyq hit F6 to bring up the Command editor
# 3. Now click the Paste Commands button
#
# Script modified to:
# 1. Clean empty strings
# 2. Use clipboard instead of selection
# 3. Add () around full list
[Command]
Command="
copyq:
// var text = str(data(mimeText)); // take selection
var text = str(clipboard()) // Take clipboard
var updated = text.split(/[\r\n]+/).map(x => `'${x}'`).join(',\\n');
copy(mimeText, '(' + updated + ')');
paste();
"
HideWindow=true
Icon=\xf00b
InMenu=true
Input=text/plain
Match=\\n
Name=Single &Quoted List