Skip to content

Commit

Permalink
new version
Browse files Browse the repository at this point in the history
  • Loading branch information
wxnacy committed May 14, 2020
1 parent a75d0d2 commit ff90407
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
Binary file added 7550C092-A6C8-4BB2-A593-865B5A9F831B.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions commands/git.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ git config credential.helper store, 储存当前仓库凭证
git config --global credential.helper store, 全局模式储存仓库凭证
git config --global credential.helper cache, 全局模式缓存凭证 15 分钟
git fetch origin {branch_name}, 把远程分支拉到本地
git pull origin master --allow-unrelated-histories, 解决拉取项目到本地新仓库 fatal: refusing to merge unrelated histories 的问题
git merge --abort, 撤销所有合并操作
2 changes: 2 additions & 0 deletions commands/other.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
df -h, 查看磁盘使用情况,并格式化输出
du -d 1 -h, 查看第一层目录的文件夹大小,并格式化输出
17 changes: 17 additions & 0 deletions commands/vagrant.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
vagrant init [name [url]], 在当前文件夹初始化 Vagrantfile
vagrant init centos/7, 在当前文件夹初始化 centos7
vagrant up , 启动虚拟机"
vagrant ssh , 登陆虚拟机"
vagrant halt , 登陆虚拟机"
vagrant destroy [name|id] , 销毁虚拟机"
vagrant destroy -f , 销毁虚拟机,并对询问回答 yes"
vagrant package , 打包 box"
vagrant package --ouput <box-name> , 打包 box,并指定包名"
vagrant status , 当前虚拟机状态
vagrant reload , 重新加载虚拟机配置
vagrant global-status, 查看所有虚拟机状态
vagrant box list, 查看所有 box 列表
vagrant box remove <box-name>, 删除 box
vagrant box remove <box-name> --box-version <version>, 删除 box,并指定版本
vagrant box update , 更新 box 版本"
vagrant box update --box <box-name>, 更新 box
8 changes: 4 additions & 4 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ done</string>
<key>escaping</key>
<integer>0</integer>
<key>keyword</key>
<string>cmds</string>
<string>cp</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
Expand All @@ -223,17 +223,17 @@ done</string>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>please</string>
<string>请稍等</string>
<key>script</key>
<string>python search_commands.py $1</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>enter to copy</string>
<string>请输入内容,按确认键或 commond + 数字键复制</string>
<key>title</key>
<string>list commands</string>
<string>复制命令和文件</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
Expand Down
15 changes: 15 additions & 0 deletions search_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

from workflow import Workflow3

ICONS = {
"git": './icon/git.png',
"vagrant": './icon/vagrant.png',
}

def read_json(filename):
lines = []
with open(filename, 'r') as f:
Expand Down Expand Up @@ -44,13 +49,23 @@ def get_all_commands():
def main(wf):
args = wf.args
logging.info(args)
first = args[0]
# 允许输入简写
if first == 'vg':
args[0] = 'vagrant'

commands = get_all_commands()

input_cmd = ' '.join(args)
for cmd in commands:
if cmd['title'].startswith(input_cmd):
cmd['valid'] = True
cmd['arg'] = cmd['title']
# 添加 icon
icon = ICONS.get(cmd['title'].split(' ')[0], './icon.png')
if icon:
cmd['icon'] = icon
logging.info(icon)
wf.add_item(**cmd)

wf.send_feedback()
Expand Down

0 comments on commit ff90407

Please sign in to comment.