From 9c432b82dd0a450555eff122d448fa4976b2d2b1 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Fri, 29 Jan 2021 15:33:34 +0900 Subject: find.py: add -b option to search BSP Signed-off-by: Kuninori Morimoto --- README.md | 3 +++ scripts/find.py | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 65d74a7..9132ec5 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ You need to have **.config** file. You can copy sample .config, and edit it - ject -s Active ... # single match - ject -s Active,New ... # multi match - ject -ns Done # not match + - ject -is -b bsp39x # bsp39x from all tasks * -a : show matched assignee task * -as : show unmatched assignee task - ject -a Wolfram ... @@ -49,6 +50,8 @@ You need to have **.config** file. You can copy sample .config, and edit it * -at : show unmatched team task - ject -t IO,MM ... - ject -nt Core ... +* -b : show BSP commits + - ject -b bsp39x ... * -f : show with file name * -r : show with relationships * --oneline : show one line diff --git a/scripts/find.py b/scripts/find.py index e0f6558..d5060cd 100755 --- a/scripts/find.py +++ b/scripts/find.py @@ -47,7 +47,7 @@ class find(base.base): #-------------------- # parse_option #-------------------- - def parse_option(self, arg, option, char, hit): + def parse_option(self, arg, option, tag, hit): op = "-l" # hit if (not hit): @@ -58,13 +58,17 @@ class find(base.base): if (cmd == option): match = 1 elif (match): - # Wolfram,Shimoda - # -> - # (Wolfram|Shimoda) - tgt = "({})".format(cmd.replace(",", "|")) - - self.files = self.run("echo \"{}\" | xargs egrep {} \"{}:\s+{}\"".\ - format(self.files, op, char, tgt)) + if (option == "-b"): + tag = cmd + tgt = "" + else: + # Wolfram,Shimoda + # -> + # (Wolfram|Shimoda) + tgt = "\s+({})".format(cmd.replace(",", "|")) + + self.files = self.run("echo \"{}\" | xargs egrep {} \"{}:{}\"".\ + format(self.files, op, tag, tgt)) return #-------------------- @@ -118,6 +122,7 @@ class find(base.base): # -na : not matched assignee # -t : matched team # -nt : not matched team + # -b : bsp if (self.files): self.parse_option(arg, "-s", "status", 1) self.parse_option(arg, "-ns", "status", 0) @@ -125,6 +130,7 @@ class find(base.base): self.parse_option(arg, "-na", "assignee", 0) self.parse_option(arg, "-t", "team", 1) self.parse_option(arg, "-nt", "team", 0) + self.parse_option(arg, "-b", None, 1) #-------------------- # get -- cgit v1.2.3