Skip to content

Commit

Permalink
Adding option to follow symbolic links
Browse files Browse the repository at this point in the history
  • Loading branch information
pfuntner committed Nov 23, 2024
1 parent 7eb474f commit 67eb607
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/find-swaps
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import bruno_tools

parser = argparse.ArgumentParser(description='FInd lingering vi swap files')
parser.add_argument('dirs', metavar='dir', nargs='*', help='Zero or more directories - default is to search starting at current working directory')
parser.add_argument('-f', '--follow', action='store_true', help='Follow symbolic links')
parser.add_argument('-d', '--dry-run', action='store_true', help='Do not run command, only print it')
parser.add_argument('-v', '--verbose', action='count', help='Enable debugging')
args = parser.parse_args()
Expand All @@ -18,7 +19,7 @@ logging.basicConfig(format='%(asctime)s %(levelname)s %(pathname)s:%(lineno)d %(
log = logging.getLogger(sys.argv[0])
log.setLevel(logging.WARNING - (args.verbose or 0)*10)

cmd = ['find'] + (args.dirs or ['.']) + ['-name', '.*.swp']
cmd = ['find'] + (args.dirs or ['.']) + (['-follow'] if args.follow else []) + ['-name', '.*.swp']
if args.dry_run:
print(shlex.join(cmd))
else:
Expand Down

0 comments on commit 67eb607

Please sign in to comment.