Skip to content
Merged
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
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
```
22 changes: 22 additions & 0 deletions neofetch_win/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -57,6 +69,8 @@ def shell() -> None:
sys.exit(0)

# Default values
only_ascii = False
stdout = False
display_art = True
art = None

Expand All @@ -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

Expand All @@ -87,6 +107,8 @@ def shell() -> None:
art_colour=artcolour,
art=art,
display_art=display_art,
only_ascii=only_ascii,
stdout=stdout
)

print(
Expand Down
31 changes: 23 additions & 8 deletions neofetch_win/neofetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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 = []

Expand Down Expand Up @@ -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)
Expand All @@ -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]
Expand All @@ -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

Expand Down
Loading