@@ -13,13 +13,22 @@ def get_current_branch_name(self):
1313 return check_output (['git' , 'rev-parse' , '--abbrev-ref' , 'HEAD' ]).decode ().strip ().strip ("'" )
1414
1515 def get_branch_name (self , options = [], preview = "git config branch.{2}.description" ):
16+ return self ._get_branches (options , preview , '--no-multi' )
17+ 18+ def get_branch_names (self , options = [], preview = "git config branch.{2}.description" ):
19+ return self ._get_branches (options , preview , '--multi' )
20+ 21+ def _get_branches (self , options , preview , multi ):
1622 format_columns = FormatColumns ()
1723 branches = check_output (['git' , '--no-pager' , 'branch' , * options , '--format=%(if)%(HEAD)%(then)%(else)%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)branch | %(refname:short)%(end)%(end)' ]).decode ()
1824 branches = check_output (['sed' , '/^$/d' ], input = str .encode (format_columns .set_colors ({0 : Fore .BLUE }).format (branches )))
19- line = self ._fzf .run (branches .decode (), preview = preview )
25+ lines = self ._fzf .run (branches .decode (), preview = preview , multi = multi )
2026
21- if line :
22- return line .split ('\t ' )[1 ].strip ()
27+ if lines :
28+ if multi == '--multi' :
29+ return list (map (lambda line : line .split ('\t ' )[1 ].strip (), lines .splitlines ()))
30+ else :
31+ return lines .split ('\t ' )[1 ].strip ()
2332
2433 def get_tag_name_from_tags (self , tags , options = [], preview = "" ):
2534 format_columns = FormatColumns ()
0 commit comments