Rails 在 CLI 中发现拼写错误,而 运行 `rails notes -a ["anything"]`
Rails Typos seen in the CLI while running `rails notes -a ["anything"]`
我使用的是最新版本
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.3/lib/rails.rb
如果您 运行 rails notes -a [" "]
您会收到一份没有拼写错误的干净列表。但是,如果您 运行 rails notes -a ["literally_any_single_letter"]
打印出的每一行都缺少其描述的第一个字母。对我来说很奇怪。
我知道我可能没有正确使用 'notes' 但我一直在努力学习,这就是我观察到的。
注释匹配器是 relativelysimple-minded。它搜索以指定注释之一开头的任何评论。默认注释是 TODO
、FIXME
和 OPTIMIZE
,但是,您可以使用 -a
或 --annotations=tag1 tag2 ...
指定您想要的任何注释。如果指定了多个注释,为了清晰起见,它们将保留在输出中:
% rails notes -a TODO FOO
app/models/foo.rb:
* [2] [TODO] Add stuff
* [3] [TODO] even more missing stuff
* [4] [FOO] this is foo
如果你只指定一个注释,它'eats'清理输出的注释:
rails notes -a TODO
app/models/foo.rb:
* [2] Add stuff
* [3] colon is optional
因此,如果您定义了一个 single-letter 注释,您将 a) 获得以该字母开头的每条评论,并且 b) 它将有助于 'eat' 输出中的字母。
% rails notes -a T
app/javascript/packs/application.js:
* [ 1] his file is automatically compiled by Webpack, along with any other files
app/models/foo.rb:
* [ 2] ODO: Add stuff
* [ 3] ODO colon is optional
由于您的示例包括将注释括在方括号 ([]) 中,我应该指出,您可能会对这样做的结果感到惊讶。 notes
命令允许您在指定注释时至少以有限的方式使用正则表达式。在 Ruby 正则表达式中,[abc]
表示 'match any one of a, b, or c'。所以:
% rails notes -a [TD]ODO
app/models/foo.rb:
* [2] [TODO] Add stuff
* [3] [TODO] even more missing stuff
* [4] [DODO] some dodo
我使用的是最新版本
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.3/lib/rails.rb
如果您 运行 rails notes -a [" "]
您会收到一份没有拼写错误的干净列表。但是,如果您 运行 rails notes -a ["literally_any_single_letter"]
打印出的每一行都缺少其描述的第一个字母。对我来说很奇怪。
我知道我可能没有正确使用 'notes' 但我一直在努力学习,这就是我观察到的。
注释匹配器是 relativelysimple-minded。它搜索以指定注释之一开头的任何评论。默认注释是 TODO
、FIXME
和 OPTIMIZE
,但是,您可以使用 -a
或 --annotations=tag1 tag2 ...
指定您想要的任何注释。如果指定了多个注释,为了清晰起见,它们将保留在输出中:
% rails notes -a TODO FOO
app/models/foo.rb:
* [2] [TODO] Add stuff
* [3] [TODO] even more missing stuff
* [4] [FOO] this is foo
如果你只指定一个注释,它'eats'清理输出的注释:
rails notes -a TODO
app/models/foo.rb:
* [2] Add stuff
* [3] colon is optional
因此,如果您定义了一个 single-letter 注释,您将 a) 获得以该字母开头的每条评论,并且 b) 它将有助于 'eat' 输出中的字母。
% rails notes -a T
app/javascript/packs/application.js:
* [ 1] his file is automatically compiled by Webpack, along with any other files
app/models/foo.rb:
* [ 2] ODO: Add stuff
* [ 3] ODO colon is optional
由于您的示例包括将注释括在方括号 ([]) 中,我应该指出,您可能会对这样做的结果感到惊讶。 notes
命令允许您在指定注释时至少以有限的方式使用正则表达式。在 Ruby 正则表达式中,[abc]
表示 'match any one of a, b, or c'。所以:
% rails notes -a [TD]ODO
app/models/foo.rb:
* [2] [TODO] Add stuff
* [3] [TODO] even more missing stuff
* [4] [DODO] some dodo