Coverage for src/features/argcomplete.py: 75.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-08 13:49 +0000

1#!/usr/bin/env python3 

2 

3# Standard libraries 

4from pathlib import Path 

5 

6# Components 

7from ..system.commands import Commands 

8 

9# Argcomplete class 

10class Argcomplete: 

11 

12 # Constants 

13 BINARY: str = 'activate-global-python-argcomplete' 

14 MARKER: str = 'added by argcomplete' 

15 

16 # Configure 

17 @staticmethod 

18 def configure() -> bool: 

19 

20 # Configure argcomplete 

21 return Commands.run(Argcomplete.BINARY, [ 

22 '--user', 

23 ]) 

24 

25 # Configured 

26 @staticmethod 

27 def configured() -> bool: 

28 

29 # Variables 

30 user_home: Path = Path.home() 

31 

32 # Detect configured files 

33 return Commands.grep( 

34 Path(user_home / '.bash_completion'), 

35 Argcomplete.MARKER, 

36 ) and Commands.grep( 

37 Path(user_home / '.zshenv'), 

38 Argcomplete.MARKER, 

39 )