Ignore home directory paths

pull/6/head
Ilya Dmitrichenko 2015-07-27 11:43:45 +01:00
parent 03070297a7
commit 5e7a6a8b89
2 changed files with 8 additions and 0 deletions

View File

@ -102,6 +102,10 @@ func gotDashF(line int, fields []string, fieldNum int) error {
// Same-dir files are usually created in the same example // Same-dir files are usually created in the same example
return nil return nil
} }
if strings.HasPrefix(target, "~/") {
// Home directory may also be created by the same example
return nil
}
if strings.HasPrefix(target, "/") { if strings.HasPrefix(target, "/") {
// Absolute paths tend to be /tmp/* and created in the same example. // Absolute paths tend to be /tmp/* and created in the same example.
return nil return nil

View File

@ -82,6 +82,10 @@ func TestKubectlDashF(t *testing.T) {
"Foo\n```\nkubectl -blah create -f/foobar\n```\nBar", "Foo\n```\nkubectl -blah create -f/foobar\n```\nBar",
true, true,
}, },
{
"Foo\n```\nkubectl -blah create -f~/foobar\n```\nBar",
true,
},
// Real checks // Real checks
{ {
"Foo\n```\nkubectl -blah create -f mungedocs.go\n```\nBar", "Foo\n```\nkubectl -blah create -f mungedocs.go\n```\nBar",