mfd 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6040f469b1c27ab7e6bc9c1f17f926c56f7542260701dfc817d5f334e963939
4
- data.tar.gz: d44e8606e7464dab230481de6f47298e8a05f5a3d7b5f838d61bc50ccfc84c9d
3
+ metadata.gz: 5c7b34e31f4606e0a0fa10a4f18d38762b33b38167f0bec54ef4aa5ea8243295
4
+ data.tar.gz: d0d5613a4a4b771de2d75fbe6e6c1149661b20b31a2b2398bbbcbfd63e0a4553
5
5
  SHA512:
6
- metadata.gz: 566377f81665afc7d9e62f352c701a8854498232a928d68f2adaac9e3759ec661f4a7833c89645282654289f87d8df961a5e66e3ec87313b6e3176ef794aed37
7
- data.tar.gz: 3bc33274dcc9c3ebc92455c23bb5c79c46c22e0c69d5bda4f67636789f7456291c2d444ffa779a53f756919d646c9ca2d333dccc2e3d9b33139a66a697b32de1
6
+ metadata.gz: d8ea175b49e34dabe032ddf79284d9b7390455fa7b527113d3cf0add59635a603718aa2fee59e5b23e3770f7fd4ea0affe1009d89e041cb88d981a31f43380b3
7
+ data.tar.gz: 54faaac4ca6d86143b4a11162e847de6251043f14d62f63b4487a7be4b1abdc2a53b9c1dd26497edf03730b17e56992317ad8d48b42c4a72654e93110c0b10f2
data/Gemfile.lock CHANGED
@@ -42,4 +42,4 @@ DEPENDENCIES
42
42
  rspec (~> 3.0)
43
43
 
44
44
  BUNDLED WITH
45
- 1.17.2
45
+ 2.4.12
data/README.md CHANGED
@@ -1,29 +1,132 @@
1
1
  # Mfd
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mfd`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ mdfind4 - a better mdfind built upon mdfind3
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
5
+ Spotlight OS X 上非常好用的一个桌面搜索工具,mdfind 是Spotlight CLI frontend,
6
+ 虽然 mdfind 的功能足够强大,但是界面非常不友好,例如,要搜索电脑中2013年的文件大小大于 1MB
7
+ 的jpg图像文件,需要一个非常复杂的命令。mdfind4 对mdfind进行封装,提供比较易用的界面
6
8
 
7
9
  ## Installation
8
10
 
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'mfd'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
11
+ Install it yourself as:
20
12
 
21
13
  $ gem install mfd
14
+
15
+ Or:
22
16
 
23
- ## Usage
17
+ $ sudo gem install mfd
24
18
 
25
- TODO: Write usage instructions here
19
+ ## Usage
26
20
 
21
+ ```
22
+ usage: mfd [options] [search dir]
23
+
24
+ 通过指定若干选项来搜索文件系统中被 Spotlight 索引的文件,每个选项之间是逻辑与的关系. 默认将
25
+ 搜索文件系统中所有的被索引文件,可以通过最后一个参数来约束其只在某个目录中进行搜索.
26
+
27
+ % mdfind4 --content-type com.omnigroup.omnigraffle.graffle --from 2011/11/1 -t '2013-01-01 14:30:24'
28
+ % mdfind4 --query '关键字' --content-type 'com.adobe.pdf'
29
+ % mdfind4 -e mp3 -b10M
30
+
31
+ options:
32
+
33
+ 以下选项均支持以一个 "@" 符号开头, 后跟一个文件名,表示此选项的值将从给定的文件中提取:
34
+
35
+ • -f, --from
36
+ • -t, --to
37
+ • -F, --from-create
38
+ • -T, --to-create
39
+ • -c, --content-type
40
+ • -k, --kind
41
+ • -b, --biggerthan
42
+ • -s, --smallerthan
43
+
44
+
45
+
46
+ -f, --from from e.g. --from 2010/1/1
47
+ 搜索"文件最后修改时间"等于或晚于指定时间的文件,时间格式为"YYYY-mm-dd HH:MM:SS"
48
+ 其中可以使用任意非数字字符作为分隔符,也可以只指定日期部分。
49
+ 另外, -f 选项还支持指定一个数字后跟一个字母的形式来指定时间,
50
+ 支持的字符包括: S, M, H, d, m, Y,分别表示: 秒, 分, 时,
51
+ 天, 月, 年, 其中一个月等于 30 天, 一年等于 365 天.
52
+ 例如, 搜索最近 10 天的文件: -f 10d
53
+
54
+ -t, --to to 搜索"文件最后修改时间"等于或早于指定时间的文件, 格式同"-f"选项
55
+
56
+ -F, --from-create from 搜索"文件创建时间"等于或晚于指定时间的文件, 格式同"-f"选项
57
+
58
+ -T, --to-create to 搜索"文件创建时间"等于或早于指定时间的文件, 格式同"-f"选项
59
+
60
+ -q, --query query e.g. --query "关键字"
61
+
62
+ -c, --content-type contenttype e.g. --contenttype com.omnigroup.omnigraffle.graffle
63
+ 搜索 "kMDItemContentType" 属性等于指定值的文件,可以不
64
+ 指定完整的 Content Type,例如 Ruby 脚本的 Content Type
65
+ 为 "public.ruby-script",但是可以使用下面的命令所有所有
66
+ Ruby 脚本文件:mdfind4 -c ruby
67
+
68
+ -e, --type file-ext-name .e.g -e 'mp3'
69
+ ContentType 字符串不便记忆,为了方便使用,本程序将常用的
70
+ 文件类型的后缀名和 kMDItemKind 字符串建立关联,可以使用本选项
71
+ 来指定要搜索的文件的后缀名, 可以使用"-l"选项查看所有支持的后
72
+ 缀名以及关联
73
+
74
+ -l, --list-types kMDItemKind 字符串不便记忆,为了方便使用,本程序将常用的
75
+ 文件类型的后缀名和 kMDItemKind 字符串建立关联,使用本选项
76
+ 看所有支持的后缀名以及关联
77
+
78
+ -k, --kind kind e.g. --kind "HTML Document"
79
+ "-k"选项是另外一个用来指定文件类型的选项,它使用
80
+ "kMDItemKind"属性来搜索文件. 例如, 搜索邮件: "-k 邮件信息"
81
+ 搜索 Safari 历史记录: "-k 'Safari 历史记录项目'"
82
+
83
+ -b, --bigger-than size e.g. --bigger-than 100000
84
+ 搜索文件大小大于或等于给定值的文件,可以使用 t, g, m, k 等单位,
85
+ 例如, 搜索大于或等于 1MB 字节的文件:"-b 1m"
86
+
87
+ -s, --smaller-than size e.g. --smaller-than 100000
88
+ 搜索文件大小小于或等于给定值的文件,可以使用 t, g, m, k 等单位,
89
+ 例如, 搜索小于或等于 1GB 字节的文件:"-b 1G"
90
+
91
+ --prop-eq arg_value
92
+ e.g. --prop-eq FSSize@diary.txt
93
+ 不同类型的文件各自都有多种多样的属性,本程序支持的属性比较有限, 若需要
94
+ 按照其他属性比较,则使用本选项以及下面三个以 "--prop"
95
+ 打头的选项。可以通过 OS X 自带的 "mdls" 命令来查看文件的各种属性,
96
+ 属性名称一般以 "kMDItem" 打头,使用这四个选项时可以只指定 "kMDItem"
97
+ 后面的部分, 本选项的值的格式为 "property@filename", 例如,
98
+ 搜索文件大小等于 a.txt 的所有文件:--prop-eq FSSize@./a.txt
99
+
100
+ --prop-ne arg_value
101
+ e.g. --prop-ne FSSize@diary.txt
102
+
103
+ --prop-le arg_value
104
+ e.g. --prop-le FSSize@diary.txt
105
+
106
+ --prop-ge arg_value
107
+ e.g. --prop-ge FSSize@diary.txt
108
+
109
+ -d, --downloadfrom url 搜索从URL下载的文件
110
+ -n, --name name 按文件名称搜索, 自动支持模糊匹配, 无需指定通配符
111
+ -0, --null Prints an ASCII NUL character after each result path.
112
+ This is useful when used in conjunction with
113
+ xargs -0.
114
+ --live
115
+ Causes the mdfind command to provide live-updates to the
116
+ number of files matching the query. When an
117
+ update causes the query results to change the
118
+ number of matches is updated. The find can
119
+ be cancelled by typing ctrl-C.
120
+
121
+ --count
122
+ Causes the mdfind command to output the total number of
123
+ matches, instead of the path to the matching
124
+ items.
125
+
126
+ --debug
127
+ mdfind4 通过调用 OS X 系统自带的 mdfind 命令来完成文件搜索,指定
128
+
129
+ ```
27
130
  ## Development
28
131
 
29
132
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.