Compare commits

...

2 Commits

Author SHA1 Message Date
2013e6b645 Add function to fetch package version from pyproject.toml" 2025-11-15 18:16:50 +00:00
Marco D'Aleo
6a73270f23 Merge pull request #14 from mdaleo404/remove_dev_dependencies
Remove bandit and black from pyproject.toml
2025-11-15 16:57:17 +00:00
2 changed files with 10 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "resrm" name = "resrm"
version = "0.3.0" version = "0.3.1"
description = "drop-in replacement for rm with undo/restore built-in." description = "drop-in replacement for rm with undo/restore built-in."
authors = ["Marco D'Aleo <marco@marcodaleo.com>"] authors = ["Marco D'Aleo <marco@marcodaleo.com>"]
license = "GPL-3.0-or-later" license = "GPL-3.0-or-later"

View File

@@ -22,11 +22,19 @@ import sys
import uuid import uuid
import datetime import datetime
import textwrap import textwrap
import importlib.metadata
from pathlib import Path from pathlib import Path
from typing import List, Dict, Optional from typing import List, Dict, Optional
# Config # Config
def get_version():
try:
return importlib.metadata.version("resrm")
except importlib.metadata.PackageNotFoundError:
return "unknown"
def get_trash_base_for_user(uid: int) -> Path: def get_trash_base_for_user(uid: int) -> Path:
"""Return the trash base path depending on whether user is root or normal.""" """Return the trash base path depending on whether user is root or normal."""
if uid == 0: if uid == 0:
@@ -389,7 +397,7 @@ def main(argv: Optional[List[str]] = None):
) )
parser.add_argument("-h", "--help", action="store_true", help="show help") parser.add_argument("-h", "--help", action="store_true", help="show help")
parser.add_argument( parser.add_argument(
"-V", "--version", action="store_true", help="show version" "-V", "--version", action="version", version=f"resrm {get_version()}"
) )
args = parser.parse_args(argv) args = parser.parse_args(argv)
@@ -398,10 +406,6 @@ def main(argv: Optional[List[str]] = None):
print(__doc__) print(__doc__)
return return
if args.version:
print("resrm 0.2.1")
return
if not args.paths and not (args.l or args.empty or args.restore): if not args.paths and not (args.l or args.empty or args.restore):
print("resrm: missing operand") print("resrm: missing operand")
print("Try 'resrm --help' for more information.") print("Try 'resrm --help' for more information.")