|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | +<plist version="1.0"> |
| 4 | +<dict> |
| 5 | + <key>bundleid</key> |
| 6 | + <string>li.zhu.alfred.gitlabproject</string> |
| 7 | + <key>connections</key> |
| 8 | + <dict> |
| 9 | + <key>63F60794-BB56-4415-9372-BAF974C3A7E1</key> |
| 10 | + <array> |
| 11 | + <dict> |
| 12 | + <key>destinationuid</key> |
| 13 | + <string>2A7AEA9A-9C99-469D-A4E5-A4B4C951F050</string> |
| 14 | + <key>modifiers</key> |
| 15 | + <integer>0</integer> |
| 16 | + <key>modifiersubtext</key> |
| 17 | + <string></string> |
| 18 | + </dict> |
| 19 | + </array> |
| 20 | + </dict> |
| 21 | + <key>createdby</key> |
| 22 | + <string>Leigh Zhu</string> |
| 23 | + <key>description</key> |
| 24 | + <string>Search GitLab project</string> |
| 25 | + <key>disabled</key> |
| 26 | + <false/> |
| 27 | + <key>name</key> |
| 28 | + <string>GitLab Projects</string> |
| 29 | + <key>objects</key> |
| 30 | + <array> |
| 31 | + <dict> |
| 32 | + <key>config</key> |
| 33 | + <dict> |
| 34 | + <key>plusspaces</key> |
| 35 | + <false/> |
| 36 | + <key>url</key> |
| 37 | + <string>{query}</string> |
| 38 | + <key>utf8</key> |
| 39 | + <true/> |
| 40 | + </dict> |
| 41 | + <key>type</key> |
| 42 | + <string>alfred.workflow.action.openurl</string> |
| 43 | + <key>uid</key> |
| 44 | + <string>2A7AEA9A-9C99-469D-A4E5-A4B4C951F050</string> |
| 45 | + <key>version</key> |
| 46 | + <integer>0</integer> |
| 47 | + </dict> |
| 48 | + <dict> |
| 49 | + <key>config</key> |
| 50 | + <dict> |
| 51 | + <key>argumenttype</key> |
| 52 | + <integer>0</integer> |
| 53 | + <key>escaping</key> |
| 54 | + <integer>36</integer> |
| 55 | + <key>keyword</key> |
| 56 | + <string>gl</string> |
| 57 | + <key>runningsubtext</key> |
| 58 | + <string>Retrieving search suggestions ...</string> |
| 59 | + <key>script</key> |
| 60 | + <string> |
| 61 | +// your private token |
| 62 | +$token = ''; |
| 63 | +
|
| 64 | +// your gitlab's url |
| 65 | +$gitlab = ''; |
| 66 | +
|
| 67 | +$options = array( |
| 68 | + CURLOPT_HTTPHEADER => array('PRIVATE-TOKEN: '.$token) |
| 69 | +); |
| 70 | +
|
| 71 | +$query = urlencode( "{query}" ); |
| 72 | +
|
| 73 | +require_once('workflows.php'); |
| 74 | +
|
| 75 | +$url = $gitlab.'/api/v3/projects/search/'.$query; |
| 76 | +
|
| 77 | +
|
| 78 | +$wf = new Workflows(); |
| 79 | +$int = 1; |
| 80 | +
|
| 81 | +$data = $wf->request( $url, $options); |
| 82 | +$repos = json_decode($data); |
| 83 | +
|
| 84 | +if(count($repos) > 0) { |
| 85 | + for( $i=0; $i<count($repos); $i++) { |
| 86 | + $item = $repos[$i]; |
| 87 | + $icon = "icon.png"; |
| 88 | + $wf->result( $int++.'.'.time(), $item->web_url , $item->path_with_namespace, "", $icon ); |
| 89 | + } |
| 90 | +} |
| 91 | +
|
| 92 | +echo $wf->toxml();</string> |
| 93 | + <key>subtext</key> |
| 94 | + <string>Search Projects on your GitLab</string> |
| 95 | + <key>title</key> |
| 96 | + <string>Search GitLab</string> |
| 97 | + <key>type</key> |
| 98 | + <integer>1</integer> |
| 99 | + <key>withspace</key> |
| 100 | + <true/> |
| 101 | + </dict> |
| 102 | + <key>type</key> |
| 103 | + <string>alfred.workflow.input.scriptfilter</string> |
| 104 | + <key>uid</key> |
| 105 | + <string>63F60794-BB56-4415-9372-BAF974C3A7E1</string> |
| 106 | + <key>version</key> |
| 107 | + <integer>0</integer> |
| 108 | + </dict> |
| 109 | + </array> |
| 110 | + <key>readme</key> |
| 111 | + <string>You should change the token to yours. |
| 112 | +
|
| 113 | +Change the token in the ‘script fliter’</string> |
| 114 | + <key>uidata</key> |
| 115 | + <dict> |
| 116 | + <key>2A7AEA9A-9C99-469D-A4E5-A4B4C951F050</key> |
| 117 | + <dict> |
| 118 | + <key>ypos</key> |
| 119 | + <real>10</real> |
| 120 | + </dict> |
| 121 | + <key>63F60794-BB56-4415-9372-BAF974C3A7E1</key> |
| 122 | + <dict> |
| 123 | + <key>ypos</key> |
| 124 | + <real>20</real> |
| 125 | + </dict> |
| 126 | + </dict> |
| 127 | + <key>webaddress</key> |
| 128 | + <string>zhu.li</string> |
| 129 | +</dict> |
| 130 | +</plist> |
0 commit comments