diff --git a/README.md b/README.md index 11969cc..fcabc47 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ If you wish to contribute, feel free to do so. - Now you can type `neofetch` in CMD to see results ### Available colours -black, red, green, yellow, blue, magenta, cyan, white +black, red, green, yellow, blue, magenta, cyan, white, windows_10_blue, windows_11_blue ### Using ASCII art 1. File has to be readable @@ -26,19 +26,24 @@ black, red, green, yellow, blue, magenta, cyan, white # Usage ``` $ neofetch --help -usage: [-h] [-v] [-c COLOUR [COLOUR ...]] [-ac ARTCOLOUR [ARTCOLOUR ...]] - [-a ART [ART ...]] [-na] +usage: [-h] [-v] [-c COLOUR [COLOUR ...]] [-l] [--stdout] [-ac ARTCOLOUR [ARTCOLOUR ...]] + [-a ART [ART ...]] [-na] [-i IGNORE [IGNORE ...]] neofetch, but for Windows -optional arguments: +options: -h, --help show this help message and exit -v, --version Show the version number and exit - -c COLOUR [COLOUR ...], --colour COLOUR [COLOUR ...] + -c COLOUR [COLOUR ...], --colour COLOUR [COLOUR ...], --color COLOUR [COLOUR ...] Change colour of the text - -ac ARTCOLOUR [ARTCOLOUR ...], --artcolour ARTCOLOUR [ARTCOLOUR ...] + -l, --logo Hide the info text and only show the ascii logo + --stdout Turn off all colors + -ac ARTCOLOUR [ARTCOLOUR ...], --artcolour ARTCOLOUR [ARTCOLOUR ...], --artcolor ARTCOLOUR [ARTCOLOUR ...] Change colour of the ascii -a ART [ART ...], --art ART [ART ...] Change the ascii art -na, --noart Turn off ascii art + -i IGNORE [IGNORE ...], --ignore IGNORE [IGNORE ...] + Ignore components (title, underline, os, uptime, ip, motherboard, cpu, gpu, ram, disk, + linebreak, colours_1, colours_2) ``` diff --git a/neofetch_win/__main__.py b/neofetch_win/__main__.py index 2c9ec87..cb574d9 100644 --- a/neofetch_win/__main__.py +++ b/neofetch_win/__main__.py @@ -23,6 +23,18 @@ def shell() -> None: default=None ) + parser.add_argument( + "-l", "--logo", + help="Hide the info text and only show the ascii logo", + action="store_true" + ) + + parser.add_argument( + "--stdout", + help="Turn off all colors", + action="store_true" + ) + parser.add_argument( "-ac", "--artcolour", "--artcolor", help="Change colour of the ascii", @@ -57,6 +69,8 @@ def shell() -> None: sys.exit(0) # Default values + only_ascii = False + stdout = False display_art = True art = None @@ -70,6 +84,12 @@ def shell() -> None: colour = "cyan" artcolour = "cyan" + if args.logo: + only_ascii = True + + if args.stdout: + stdout = True + if args.noart: display_art = False @@ -87,6 +107,8 @@ def shell() -> None: art_colour=artcolour, art=art, display_art=display_art, + only_ascii=only_ascii, + stdout=stdout ) print( diff --git a/neofetch_win/neofetch.py b/neofetch_win/neofetch.py index 2a744dc..c5af7e1 100644 --- a/neofetch_win/neofetch.py +++ b/neofetch_win/neofetch.py @@ -33,13 +33,18 @@ def __init__( art: str | None = None, display_art: bool = True, colour: str = "cyan", - art_colour: str | None = None + art_colour: str | None = None, + only_ascii: bool = False, + stdout: bool = False, ): self.wmi: _wmi_class = WMI() self.spacing: int = 0 self.art = art self.display_art = display_art + self.only_ascii = only_ascii + + self.stdout = stdout self.colour = self.colours(colour) self.art_colour = self.colours(art_colour) @@ -78,6 +83,10 @@ def colourize(self, text: str) -> str: ------- The colourized text """ + + if self.stdout: + return text + return f"{self.colour}{text}{Ansi.reset}" def disk_space(self, partition: str) -> tuple[int, int, int]: @@ -164,6 +173,10 @@ def get_art(self) -> list[str]: @property def colour_blocks(self) -> tuple[str, str]: """ Return the colour blocks. """ + + if self.stdout: + return "", "" + rows_1 = [] rows_2 = [] @@ -338,7 +351,7 @@ def pretty_print(self, ignore_list: list[str] | None = None) -> str: ] for name, info in components_list: - if name in ignore_list: + if(name in ignore_list) or self.only_ascii: continue components.append(info) @@ -356,7 +369,10 @@ def pretty_print(self, ignore_list: list[str] | None = None) -> str: if self.display_art: if len(art) > len(components): # Prefer the bigger array to iterate over for index, art_line in enumerate(art): - line = f"{self.art_colour}{art_line:<{spacing}}{Ansi.reset}" + line = f"{art_line:<{spacing}}" + + if not self.stdout: + line = f"{self.art_colour}{line}{Ansi.reset}" if index < len(components): line += components[index] @@ -365,11 +381,10 @@ def pretty_print(self, ignore_list: list[str] | None = None) -> str: else: for index, component in enumerate(components): - line = ( - f"{self.art_colour}{art[index]:<{spacing}}{Ansi.reset}" - if index < len(art) else - f"{'':<{spacing}}" - ) + line = f"{art[index]:<{spacing}}" if index < len(art) else f"{'':<{spacing}}" + + if not self.stdout: + line = f"{self.art_colour}{line}{Ansi.reset}" line += component