From 4178e84042da1c8e75d8b8975fb16e04df1c3d58 Mon Sep 17 00:00:00 2001 From: karajan1001 Date: Fri, 7 Aug 2020 18:15:27 +0800 Subject: [PATCH 01/16] `--stdin` and `--all` for `dvc check-ignore` cmd Fixes #1674, Only a draft one. --- .../docs/command-reference/check-ignore.md | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 4a99f6d591..e33bfb1dc3 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -6,7 +6,7 @@ patterns found in [`.dvcignore`](/doc/user-guide/dvcignore). ## Synopsis ```usage -usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-n] +usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-n] [--stdin] [-a] targets [targets ...] positional arguments: @@ -37,6 +37,11 @@ ones that are ignored indeed are printed back. - `-v`, `--verbose` - displays detailed tracing information. +- `--stdin` - Read pathnames from the standard input, one per line, + instead of from the command-line. +- `-a`, `--all` - Show all of the patterns match the target paths. Only + usable when `--details` is also employed + ## Examples First, let's create a `.dvcignore` file with some patterns in it, and some files @@ -81,6 +86,15 @@ $ dvc check-ignore -d file* .dvcignore:2:!file2 file2 ``` +By default, only the last pattern matched would be shown, if we want to see all +of the patterns matched, `--all` option would help you. + +```dvc +$ dvc check-ignore -d -a file2 +.dvcignore:1:file* file2 +.dvcignore:2:!file2 file2 +``` + With the `--non-matching` option, non-matching `targets` will also be included in the list. All fields in each line, except for ``, will be empty. @@ -88,3 +102,22 @@ in the list. All fields in each line, except for ``, will be empty. $ dvc check-ignore -d -n other :: other ``` + +At last `--stdin` provides an interactive cmd line tool for our pattern +debugging. + +```dvc +$ dvc check-ignore --stdin +> file1 +file1 +> other +> file2 +file2 +``` + +It can also be used in a Unix pipeline as a component. + +```dvc +cat file_list | dvc check-ignore --stdin +``` + From d54f673f6d9262010b2c7aafba1055d34831ee05 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 16:56:28 -0500 Subject: [PATCH 02/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index e33bfb1dc3..e8d9e1bd34 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -6,7 +6,7 @@ patterns found in [`.dvcignore`](/doc/user-guide/dvcignore). ## Synopsis ```usage -usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-n] [--stdin] [-a] +usage: usage: dvc check-ignore [-h] [-q | -v] [-d] [-a] [-n] [--stdin] targets [targets ...] positional arguments: @@ -120,4 +120,3 @@ It can also be used in a Unix pipeline as a component. ```dvc cat file_list | dvc check-ignore --stdin ``` - From 54ef4b76e60132216f3648ef5e2abcce17794019 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:00:01 -0500 Subject: [PATCH 03/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index e8d9e1bd34..44a6e3dbc4 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -37,8 +37,9 @@ ones that are ignored indeed are printed back. - `-v`, `--verbose` - displays detailed tracing information. -- `--stdin` - Read pathnames from the standard input, one per line, - instead of from the command-line. +- `--stdin` - Read paths interactively from standard input instead of providing + `targets`. Exit with `Ctrl+C`. + - `-a`, `--all` - Show all of the patterns match the target paths. Only usable when `--details` is also employed From e498149a41a7eaa45bc044a02752004075508ce1 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:01:58 -0500 Subject: [PATCH 04/16] Update content/docs/command-reference/check-ignore.md per https://github.com/iterative/dvc/pull/4323#pullrequestreview-463605944 --- content/docs/command-reference/check-ignore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 44a6e3dbc4..9a8b2ba48d 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -40,7 +40,7 @@ ones that are ignored indeed are printed back. - `--stdin` - Read paths interactively from standard input instead of providing `targets`. Exit with `Ctrl+C`. -- `-a`, `--all` - Show all of the patterns match the target paths. Only +- `-a`, `--all` - show all of the patterns match the target paths. Only usable when `--details` is also employed ## Examples From 72a88e015e022ea37e3ae1d148ffc86ae62639ad Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:02:46 -0500 Subject: [PATCH 05/16] Update content/docs/command-reference/check-ignore.md per https://github.com/iterative/dvc/pull/4323#pullrequestreview-463604593 --- content/docs/command-reference/check-ignore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 9a8b2ba48d..fe225192ad 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -37,7 +37,7 @@ ones that are ignored indeed are printed back. - `-v`, `--verbose` - displays detailed tracing information. -- `--stdin` - Read paths interactively from standard input instead of providing +- `--stdin` - read paths interactively from standard input instead of providing `targets`. Exit with `Ctrl+C`. - `-a`, `--all` - show all of the patterns match the target paths. Only From 92b67e57efae770dd51b36283efdd2b1a226cc8c Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:45:57 -0500 Subject: [PATCH 06/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index fe225192ad..0d4f016149 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -40,8 +40,8 @@ ones that are ignored indeed are printed back. - `--stdin` - read paths interactively from standard input instead of providing `targets`. Exit with `Ctrl+C`. -- `-a`, `--all` - show all of the patterns match the target paths. Only - usable when `--details` is also employed +- `-a`, `--all` - show all the patterns that match each target path. Only usable + when `--details` is also employed ## Examples From 354684f34d9ae1c5c63caffe37f69a29108fa062 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:47:21 -0500 Subject: [PATCH 07/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 0d4f016149..3dfdcd2901 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -87,8 +87,8 @@ $ dvc check-ignore -d file* .dvcignore:2:!file2 file2 ``` -By default, only the last pattern matched would be shown, if we want to see all -of the patterns matched, `--all` option would help you. +By default, only the last pattern matched would be shown To see all the patterns +matched, use `--all` (`-a`). ```dvc $ dvc check-ignore -d -a file2 From 6722417cb73a15a29990b089979ef3529f26a061 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:48:48 -0500 Subject: [PATCH 08/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 3dfdcd2901..938f418f53 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -87,8 +87,8 @@ $ dvc check-ignore -d file* .dvcignore:2:!file2 file2 ``` -By default, only the last pattern matched would be shown To see all the patterns -matched, use `--all` (`-a`). +By default, only the last pattern matched would be shown. To see all the +patterns matched, use `--all` (`-a`). ```dvc $ dvc check-ignore -d -a file2 From 1c0fea1c4fe5286eef4ead52d05ddfe061760a66 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:52:04 -0500 Subject: [PATCH 09/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 938f418f53..f75f3370d7 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -96,8 +96,9 @@ $ dvc check-ignore -d -a file2 .dvcignore:2:!file2 file2 ``` -With the `--non-matching` option, non-matching `targets` will also be included -in the list. All fields in each line, except for ``, will be empty. +With the `--non-matching` (`-n`) option, non-matching `targets` will also be +included in the list. All fields in each line, except for ``, will +be empty. ```dvc $ dvc check-ignore -d -n other From 61f78d79f27d2a40781277c812b839aaa83ba41e Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:53:57 -0500 Subject: [PATCH 10/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index f75f3370d7..0bea080b62 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -105,8 +105,9 @@ $ dvc check-ignore -d -n other :: other ``` -At last `--stdin` provides an interactive cmd line tool for our pattern -debugging. +## Example: Check paths interactively + +The `--stdin` option provides an interactive way to debug `.dvcignore` patterns: ```dvc $ dvc check-ignore --stdin From 924d8ead8f055f3f11cf8f5eb918518282e1174c Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:56:17 -0500 Subject: [PATCH 11/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 0bea080b62..223ca62236 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -118,7 +118,7 @@ file1 file2 ``` -It can also be used in a Unix pipeline as a component. +It can also be used as a component of a POSIX pipe: ```dvc cat file_list | dvc check-ignore --stdin From a8cc09a699e64740deda7512672a2c1dd211fa07 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 17:58:56 -0500 Subject: [PATCH 12/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 223ca62236..71c03ce9a4 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -37,8 +37,8 @@ ones that are ignored indeed are printed back. - `-v`, `--verbose` - displays detailed tracing information. -- `--stdin` - read paths interactively from standard input instead of providing - `targets`. Exit with `Ctrl+C`. +- `--stdin` - read paths from standard input instead of providing `targets`. + Useful for interactive debugging (exit with `Ctrl+C`) and POSIX pipes. - `-a`, `--all` - show all the patterns that match each target path. Only usable when `--details` is also employed From b21a8966b90c690adb10d554d26261c664415fe6 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 18:02:04 -0500 Subject: [PATCH 13/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 71c03ce9a4..260301b4dc 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -105,7 +105,7 @@ $ dvc check-ignore -d -n other :: other ``` -## Example: Check paths interactively +## Example: Check paths interactively or programmatically The `--stdin` option provides an interactive way to debug `.dvcignore` patterns: From 8ab0f5a5e2849ecb2267ced01eb5a0434938f1a9 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Fri, 7 Aug 2020 18:33:45 -0500 Subject: [PATCH 14/16] Update content/docs/command-reference/check-ignore.md --- content/docs/command-reference/check-ignore.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 260301b4dc..21419bad5a 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -40,8 +40,8 @@ ones that are ignored indeed are printed back. - `--stdin` - read paths from standard input instead of providing `targets`. Useful for interactive debugging (exit with `Ctrl+C`) and POSIX pipes. -- `-a`, `--all` - show all the patterns that match each target path. Only usable - when `--details` is also employed +- `-a`, `--all` - include all the patterns that match each target path in the + `--details` list. Has no effect without `--details`. ## Examples From d439d011e2c6614807ce9f2eabf13e5f1227f804 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Mon, 10 Aug 2020 10:42:49 -0500 Subject: [PATCH 15/16] Update content/docs/command-reference/check-ignore.md per iterative/dvc/pull/4368 --- content/docs/command-reference/check-ignore.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index 21419bad5a..e9fa2cdd30 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -38,7 +38,7 @@ ones that are ignored indeed are printed back. - `-v`, `--verbose` - displays detailed tracing information. - `--stdin` - read paths from standard input instead of providing `targets`. - Useful for interactive debugging (exit with `Ctrl+C`) and POSIX pipes. + Useful for interactive debugging and POSIX pipes. - `-a`, `--all` - include all the patterns that match each target path in the `--details` list. Has no effect without `--details`. From 52e91249ff80e5ab7add8eac403554242c343c4f Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Tue, 18 Aug 2020 22:41:37 -0600 Subject: [PATCH 16/16] cmd: finish check-ignore --stdin/all update per https://github.com/iterative/dvc.org/pull/1675#pullrequestreview-464355279 et al --- content/docs/command-reference/check-ignore.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/content/docs/command-reference/check-ignore.md b/content/docs/command-reference/check-ignore.md index e9fa2cdd30..cdb3445a8c 100644 --- a/content/docs/command-reference/check-ignore.md +++ b/content/docs/command-reference/check-ignore.md @@ -28,7 +28,13 @@ ones that are ignored indeed are printed back. - `-d`, `--details` - show the exclude pattern together with each target path. - `-n`, `--non-matching` - show the target paths which don’t match any pattern. - Only usable when `--details` is also employed + Only usable along with `--details`. + +- `-a`, `--all` - include all the patterns that match each target path in the + `--details` list. Only usable along with `--details`. + +- `--stdin` - read target paths from standard input instead of using the + `targets` arguments. Useful for interactive debugging and POSIX pipes. - `-h`, `--help` - prints the usage/help message, and exit. @@ -37,12 +43,6 @@ ones that are ignored indeed are printed back. - `-v`, `--verbose` - displays detailed tracing information. -- `--stdin` - read paths from standard input instead of providing `targets`. - Useful for interactive debugging and POSIX pipes. - -- `-a`, `--all` - include all the patterns that match each target path in the - `--details` list. Has no effect without `--details`. - ## Examples First, let's create a `.dvcignore` file with some patterns in it, and some files @@ -121,5 +121,5 @@ file2 It can also be used as a component of a POSIX pipe: ```dvc -cat file_list | dvc check-ignore --stdin +cat file_list | dvc check-ignore --stdin ```