Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to press Ctrl-enter to copy package name #20

Merged
merged 14 commits into from
Jan 11, 2019
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ alfy.fetch('https://api.npms.io/v2/search', {
},
cmd: {
subtitle: `${pkg.version} published at ${dateFormat('yyyy-dd-MM', new Date(pkg.date))} by ${(pkg.author && pkg.author.name) || pkg.publisher.username}`
},
ctrl: {
arg: pkg.name,
subtitle: `Copy Package ${pkg.name}`
mattfwood marked this conversation as resolved.
Show resolved Hide resolved
}
},
quicklookurl: pkg.links.repository && `${pkg.links.repository}#readme`
Expand Down
52 changes: 49 additions & 3 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>npms</string>
<key>bundleid</key>
<string>com.sindresorhus.npms</string>
<key>category</key>
Expand All @@ -22,10 +20,26 @@
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>1D5CCA30-1058-4848-B3BA-52862B065B7C</string>
<key>modifiers</key>
<integer>262144</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Sindre Sorhus</string>
<key>description</key>
<string>Alfred 3 workflow to search for npm packages with npms.io</string>
mattfwood marked this conversation as resolved.
Show resolved Hide resolved
<key>disabled</key>
<false/>
<key>name</key>
<string>npms</string>
<key>objects</key>
<array>
<dict>
Expand All @@ -52,6 +66,10 @@
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
Expand Down Expand Up @@ -90,15 +108,39 @@
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>autopaste</key>
<true/>
<key>clipboardtext</key>
<string>{query}</string>
<key>transient</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.output.clipboard</string>
<key>uid</key>
<string>1D5CCA30-1058-4848-B3BA-52862B065B7C</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>1D5CCA30-1058-4848-B3BA-52862B065B7C</key>
<dict>
<key>xpos</key>
<integer>180</integer>
<key>ypos</key>
<integer>130</integer>
</dict>
<key>785375A5-6E6C-4EDE-8F20-D5B487D19AD2</key>
<dict>
<key>xpos</key>
<integer>150</integer>
<integer>180</integer>
<key>ypos</key>
<integer>10</integer>
</dict>
Expand All @@ -110,5 +152,9 @@
<integer>10</integer>
</dict>
</dict>
<key>version</key>
<string>1.1.0</string>
<key>webaddress</key>
<string>https://github.com/sindresorhus/alfred-npms#readme</string>
mattfwood marked this conversation as resolved.
Show resolved Hide resolved
</dict>
</plist>
14 changes: 8 additions & 6 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ import alfyTest from 'alfy-test';
test(async t => {
const alfy = alfyTest();

const result = await alfy('boost-exact:true chalk'); // Ensure chalk is first
const result = await alfy('boost-exact:true chalk'); // Ensure chalk is first
delete result[0].mods.cmd;

t.deepEqual(result[0], {
title: 'chalk',
subtitle: 'Terminal string styling done right. Much color',
subtitle: 'Terminal string styling done right',
arg: 'https://github.com/chalk/chalk',
mods:
{
alt:
{
mods: {
alt: {
arg: 'https://www.npmjs.com/package/chalk',
subtitle: 'Open the npm page instead of the GitHub repo'
},
ctrl: {
arg: 'chalk',
subtitle: `Paste Package chalk`
mattfwood marked this conversation as resolved.
Show resolved Hide resolved
}
},
quicklookurl: 'https://github.com/chalk/chalk#readme'
Expand Down