Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/mvim/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def main():
action="store_true",
help="do not ignore entries starting with “.”.",
)
parser.add_argument(
"--directory",
action="store_true",
help="list directories themselves, not their contents",
)
parser.add_argument(
"-s",
"--follow-symlinks",
Expand Down
21 changes: 13 additions & 8 deletions src/mvim/mvim.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def __init__(
*,
all_files=False,
follow_symlinks=False,
directory=False,
force=False,
recursive=False,
windows=False,
Expand All @@ -95,6 +96,7 @@ def __init__(

self.all_files = all_files
self.follow_symlinks = follow_symlinks
self.directory = directory
self.force = force
self.recursive = recursive
self.windows = windows
Expand Down Expand Up @@ -135,15 +137,18 @@ def add(self, path):
path = path.resolve().relative_to(Path.cwd())

if path.is_dir():
self.oldnames.extend(
sorted(
[
p
for p in path.iterdir()
if self.all_files or not p.as_posix().startswith(".")
]
if self.directory:
self.oldnames.append(path)
else:
self.oldnames.extend(
sorted(
[
p
for p in path.iterdir()
if self.all_files or not p.as_posix().startswith(".")
]
)
)
)
elif path.is_file() or path.is_symlink():
self.oldnames.append(path)
else:
Expand Down