mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-31 11:49:50 +00:00
committed by
Marc Cornellà
parent
22093bb8af
commit
57e063c711
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.vscode/*
|
||||||
|
|
||||||
|
# file for testing the theme scripts:
|
||||||
|
themes-files/*
|
||||||
|
reports/*
|
||||||
3
Home.md
3
Home.md
@@ -41,7 +41,8 @@ Once Oh My Zsh is installed:
|
|||||||
|
|
||||||
- Take a look at the most common questions and gotchas in the [[FAQ]].
|
- Take a look at the most common questions and gotchas in the [[FAQ]].
|
||||||
- Get a quick summary of the built-in plugins: [[Plugins Overview]].
|
- Get a quick summary of the built-in plugins: [[Plugins Overview]].
|
||||||
- Take a look at our [[Themes]] and [[Plugins]] (read the READMEs first!).
|
- Take a look at our [[Themes]] and their functionality: [[Themes Overview]].
|
||||||
|
- And check out our full list of [[Plugins]] (read the READMEs first!).
|
||||||
- If you need more, you can look at [[External themes]] and [[External plugins]].
|
- If you need more, you can look at [[External themes]] and [[External plugins]].
|
||||||
**Take caution, we do not review these.**
|
**Take caution, we do not review these.**
|
||||||
- Have a look at the [[Cheatsheet]] for other Oh My Zsh tricks.
|
- Have a look at the [[Cheatsheet]] for other Oh My Zsh tricks.
|
||||||
|
|||||||
154
Themes-Overview.md
Normal file
154
Themes-Overview.md
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
<!-- prettier-ignore-start -->
|
||||||
|
> _This wiki is automatically published from [ohmyzsh/wiki](https://github.com/ohmyzsh/wiki). To edit this page,_
|
||||||
|
> _go to [ohmyzsh/wiki](https://github.com/ohmyzsh/wiki), make your changes and submit a Pull Request._
|
||||||
|
<!-- prettier-ignore-end -->
|
||||||
|
|
||||||
|
# Themes Overview
|
||||||
|
|
||||||
|
This list represents the functionality for each one of our themes. You can see every theme and their screenshot in [[Themes]].
|
||||||
|
|
||||||
|
| Theme | Username | Hostname | Time/Date | Last Failure | PWD style | Other info |
|
||||||
|
| -------------------- | -------: | -------: | --------: | -----------: | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| 3den | True | True | True | False | shortened path | git, ruby, git, ruby |
|
||||||
|
| Soliah | True | True | False | False | shortened path | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| adben | True | True | True | False | shortened path | git, svn, vcs_info, fortune_commandlinefu, ssh_indicator, git, svn, vcs_info, fortune_commandlinefu, ssh_indicator |
|
||||||
|
| af-magic | True | True | False | True | shortened path | git, hg, vcs_info, virtualenv, root_indicator, conda, git, hg, vcs_info, virtualenv, root_indicator, conda |
|
||||||
|
| afowler | False | True | False | True | shortened path (3 folders) | git, hg, root_indicator, git, hg, root_indicator |
|
||||||
|
| agnoster | True | True | False | True | basename (current directory name) | git, hg, vcs_info, virtualenv, root_indicator, aws, terraform, conda, ssh_indicator, bzr, git, hg, vcs_info, virtualenv, root_indicator, aws, terraform, conda, ssh_indicator, bzr |
|
||||||
|
| alanpeabody | True | True | False | True | shortened path | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| amuse | False | False | True | False | shortened path | git, virtualenv, ruby, git, virtualenv, ruby |
|
||||||
|
| apple | False | False | False | False | basename (current directory name) | git, svn, vcs_info, git, svn, vcs_info |
|
||||||
|
| arrow | False | False | False | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| aussiegeek | True | True | True | False | shortened path | git, ruby, git, ruby |
|
||||||
|
| avit | True | True | False | True | shortened path (3 folders) | git, ruby, history_number, root_indicator, vi-mode, ssh_indicator, git, ruby, history_number, root_indicator, vi-mode, ssh_indicator |
|
||||||
|
| awesomepanda | False | False | False | True | basename (current directory name) | git, svn, git, svn |
|
||||||
|
| bira | True | True | False | True | shortened path | git, hg, vcs_info, virtualenv, ruby, root_indicator, kube, conda, rvm, git, hg, vcs_info, virtualenv, ruby, root_indicator, kube, conda, rvm |
|
||||||
|
| blinks | True | True | False | False | shortened path | git, history_number, root_indicator, git, history_number, root_indicator |
|
||||||
|
| bureau | True | True | True | False | shortened path | git, root_indicator, nodejs, git, root_indicator, nodejs |
|
||||||
|
| candy | True | True | True | False | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| candy-kingdom | True | True | False | True | shortened path | git, hg, battery, git, hg, battery |
|
||||||
|
| clean | True | False | True | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| cloud | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| crcandy | True | True | True | False | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| crunch | False | False | True | False | shortened path | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| cypher | False | True | False | True | shortened path (3 folders) | - |
|
||||||
|
| dallas | True | True | True | False | shortened path | git, ruby, root_indicator, git, ruby, root_indicator |
|
||||||
|
| darkblood | True | True | False | True | shortened path | git, git |
|
||||||
|
| daveverwer | False | True | False | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| dieter | True | True | True | True | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| dogenpunk | False | True | False | True | shortened path | git, hg, history_number, git, hg, history_number |
|
||||||
|
| dpoggi | True | True | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| dst | True | True | True | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| dstufft | True | True | False | False | shortened path | git, hg, virtualenv, git, hg, virtualenv |
|
||||||
|
| duellj | True | True | True | False | shortened path | history_number, history_number |
|
||||||
|
| eastwood | False | False | False | False | shortened path | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| edvardm | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| emotty | True | True | False | True | shortened path (3 folders) | git, hg, svn, vcs_info, root_indicator, ssh_indicator, git, hg, svn, vcs_info, root_indicator, ssh_indicator |
|
||||||
|
| essembeh | True | True | False | True | shortened path | git, root_indicator, ssh_indicator, git, root_indicator, ssh_indicator |
|
||||||
|
| evan | False | True | False | False | shortened path (2 folders) | - |
|
||||||
|
| fino | True | True | False | False | shortened path | git, virtualenv, ruby, git, virtualenv, ruby |
|
||||||
|
| fino-time | True | True | True | False | shortened path | git, virtualenv, ruby, conda, rvm, git, virtualenv, ruby, conda, rvm |
|
||||||
|
| fishy | True | True | False | True | shortened path | git, root_indicator, ssh_indicator, git, root_indicator, ssh_indicator |
|
||||||
|
| flazz | False | True | False | True | shortened path (3 folders) | git, root_indicator, vi-mode, git, root_indicator, vi-mode |
|
||||||
|
| fletcherm | True | False | True | False | shortened path (3 folders) | git, git |
|
||||||
|
| fox | True | True | False | False | shortened path | git, git |
|
||||||
|
| frisk | True | True | True | False | full path | git, bzr, git, bzr |
|
||||||
|
| frontcube | False | False | False | False | shortened path | git, ruby, git, ruby |
|
||||||
|
| funky | True | True | False | True | shortened path | history_number, root_indicator, history_number, root_indicator |
|
||||||
|
| fwalch | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| gallifrey | False | True | False | True | shortened path (2 folders) | git, root_indicator, git, root_indicator |
|
||||||
|
| gallois | False | False | False | True | shortened path | git, hg, vcs_info, command_duration, git, hg, vcs_info, command_duration |
|
||||||
|
| garyblessington | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| gentoo | True | True | False | False | shortened path (1 folders) | git, svn, vcs_info, root_indicator, git, svn, vcs_info, root_indicator |
|
||||||
|
| geoffgarside | True | False | True | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| gianu | True | True | False | False | basename (current directory name) | git, git |
|
||||||
|
| gnzh | True | True | False | True | shortened path | git, virtualenv, ruby, root_indicator, ssh_indicator, git, virtualenv, ruby, root_indicator, ssh_indicator |
|
||||||
|
| gozilla | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| half-life | True | False | False | False | basename (current directory name) | git, svn, vcs_info, virtualenv, ruby, rvm, git, svn, vcs_info, virtualenv, ruby, rvm |
|
||||||
|
| humza | True | False | False | False | shortened path | git, git |
|
||||||
|
| imajes | False | False | False | False | shortened path | - |
|
||||||
|
| intheloop | True | True | False | True | shortened path | git, ssh_indicator, git, ssh_indicator |
|
||||||
|
| itchy | True | True | False | True | shortened path | git, ruby, git, ruby |
|
||||||
|
| jaischeema | False | True | False | False | shortened path | git, ruby, git, ruby |
|
||||||
|
| jbergantine | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| jispwoso | True | True | False | True | full path | git, git |
|
||||||
|
| jnrowe | False | True | False | True | shortened path (2 folders) | git, vcs_info, ssh_indicator, git, vcs_info, ssh_indicator |
|
||||||
|
| jonathan | True | True | True | True | shortened path | git, virtualenv, ruby, root_indicator, conda, git, virtualenv, ruby, root_indicator, conda |
|
||||||
|
| josh | True | True | False | True | shortened path | git, ruby, git, ruby |
|
||||||
|
| jreese | True | True | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| jtriley | True | True | True | False | full path | - |
|
||||||
|
| juanghurtado | True | True | False | False | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| junkfood | True | True | True | False | shortened path | git, git |
|
||||||
|
| kafeitu | True | True | False | False | shortened path | git, git |
|
||||||
|
| kardan | False | True | False | False | shortened path | git, git |
|
||||||
|
| kennethreitz | False | False | False | True | basename (current directory name) | git, virtualenv, root_indicator, git, virtualenv, root_indicator |
|
||||||
|
| kiwi | False | False | False | False | shortened path (2 folders) | git, svn, battery, git, svn, battery |
|
||||||
|
| kolo | False | False | False | False | basename (current directory name) | git, svn, vcs_info, git, svn, vcs_info |
|
||||||
|
| kphoen | True | True | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| lambda | False | False | False | False | shortened path | git, git |
|
||||||
|
| linuxonly | True | True | False | True | full path | git, vcs_info, git, vcs_info |
|
||||||
|
| lukerandall | True | True | False | True | shortened path (2 folders) | git, git |
|
||||||
|
| macovsky | False | False | False | True | shortened path | git, ruby, git, ruby |
|
||||||
|
| macovsky-ruby | False | False | False | True | shortened path | git, ruby, git, ruby |
|
||||||
|
| maran | True | True | False | False | full path | git, root_indicator, git, root_indicator |
|
||||||
|
| mgutz | False | False | False | False | shortened path (1 folders) | git, root_indicator, git, root_indicator |
|
||||||
|
| mh | True | False | False | False | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| michelebologna | True | True | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| mikeh | True | True | True | False | shortened path | vcs_info, vcs_info |
|
||||||
|
| miloshadzic | False | False | False | False | shortened path (1 folders) | git, git |
|
||||||
|
| minimal | False | False | False | False | shortened path (2 folders) | git, hg, svn, vcs_info, git, hg, svn, vcs_info |
|
||||||
|
| mira | True | True | False | True | shortened path | git, ruby, rvm, nodejs, jenv, git, ruby, rvm, nodejs, jenv |
|
||||||
|
| mlh | True | True | True | True | shortened path (1 folders) | git, customizable, git, customizable |
|
||||||
|
| mortalscumbag | True | True | False | True | shortened path | git, root_indicator, ssh_indicator, git, root_indicator, ssh_indicator |
|
||||||
|
| mrtazz | False | True | False | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| murilasso | True | True | False | True | shortened path | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| muse | False | False | False | False | shortened path | git, virtualenv, git, virtualenv |
|
||||||
|
| nanotech | False | True | True | False | shortened path | git, git |
|
||||||
|
| nebirhos | False | True | False | False | basename (current directory name) | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| nicoulaj | True | True | False | True | basename (current directory name) | git, hg, vcs_info, root_indicator, ssh_indicator, bzr, git, hg, vcs_info, root_indicator, ssh_indicator, bzr |
|
||||||
|
| norm | False | True | False | False | basename (current directory name) | git, hg, git, hg |
|
||||||
|
| obraun | True | True | True | True | shortened path (3 folders) | git, root_indicator, git, root_indicator |
|
||||||
|
| oldgallois | False | False | False | True | shortened path | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| peepcode | False | False | False | True | shortened path | git, virtualenv, ruby, git, virtualenv, ruby |
|
||||||
|
| philips | True | False | True | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| pmcgee | True | True | True | False | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| pygmalion | True | True | False | False | shortened path (0 folders) | git, git |
|
||||||
|
| pygmalion-virtualenv | True | True | False | False | shortened path (0 folders) | git, virtualenv, git, virtualenv |
|
||||||
|
| random | False | False | False | False | shortened path | - |
|
||||||
|
| re5et | True | True | True | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| refined | True | True | True | True | basename (current directory name) | git, hg, vcs_info, ssh_indicator, bzr, command_duration, git, hg, vcs_info, ssh_indicator, bzr, command_duration |
|
||||||
|
| rgm | True | True | False | True | shortened path | git, git |
|
||||||
|
| risto | True | True | False | False | shortened path (2 folders) | git, root_indicator, git, root_indicator |
|
||||||
|
| rixius | True | False | True | False | shortened path | git, git |
|
||||||
|
| rkj | True | True | True | True | shortened path | - |
|
||||||
|
| rkj-repos | True | True | True | True | shortened path | git, hg, git, hg |
|
||||||
|
| robbyrussell | False | False | False | True | basename (current directory name) | git, git |
|
||||||
|
| sammy | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| simonoff | True | True | False | True | shortened path | git, ruby, root_indicator, rvm, git, ruby, root_indicator, rvm |
|
||||||
|
| simple | False | False | False | False | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| skaro | False | False | False | False | shortened path (2 folders) | git, history_number, git, history_number |
|
||||||
|
| smt | False | True | False | True | shortened path | git, hg, history_number, git, hg, history_number |
|
||||||
|
| sonicradish | False | True | False | True | basename (current directory name) | git, vcs_info, root_indicator, git, vcs_info, root_indicator |
|
||||||
|
| sorin | False | False | False | True | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| sporty_256 | True | True | False | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| steeef | True | True | False | False | basename (current directory name) | git, svn, vcs_info, virtualenv, git, svn, vcs_info, virtualenv |
|
||||||
|
| strug | True | True | False | False | shortened path | git, git |
|
||||||
|
| sunaku | False | False | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| sunrise | False | False | False | True | shortened path (2 folders) | git, root_indicator, git, root_indicator |
|
||||||
|
| superjarin | False | False | False | False | shortened path | git, ruby, git, ruby |
|
||||||
|
| suvash | True | True | False | False | shortened path | git, hg, virtualenv, ruby, git, hg, virtualenv, ruby |
|
||||||
|
| takashiyoshida | True | True | False | False | basename (current directory name) | git, root_indicator, git, root_indicator |
|
||||||
|
| terminalparty | False | True | False | True | shortened path (2 folders) | git, git |
|
||||||
|
| theunraveler | False | False | False | False | basename (current directory name) | git, git |
|
||||||
|
| tjkirch | True | True | True | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| tjkirch_mod | True | True | True | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| tonotdo | True | False | True | False | shortened path (3 folders) | git, git |
|
||||||
|
| trapd00r | True | True | False | True | shortened path | git, vcs_info, git, vcs_info |
|
||||||
|
| wedisagree | False | False | True | True | basename (current directory name) | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| wezm | False | False | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| wezm+ | True | True | False | True | shortened path | git, root_indicator, git, root_indicator |
|
||||||
|
| wuffers | False | False | False | False | basename (current directory name) | git, ruby, rvm, git, ruby, rvm |
|
||||||
|
| xiong-chiamiov | True | True | True | False | shortened path | - |
|
||||||
|
| xiong-chiamiov-plus | True | True | True | False | shortened path | git, git |
|
||||||
|
| ys | True | True | True | True | shortened path | git, hg, svn, vcs_info, virtualenv, root_indicator, git, hg, svn, vcs_info, virtualenv, root_indicator |
|
||||||
|
| zhann | False | False | False | False | basename (current directory name) | git, svn, vcs_info, git, svn, vcs_info |
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
- **[[Home]]**
|
- **[[Home]]**
|
||||||
- **[[FAQ]]**
|
- **[[FAQ]]**
|
||||||
- **[[Plugins Overview]]**
|
- **[[Plugins Overview]]**
|
||||||
|
- **[[Themes Overview]]**
|
||||||
- **Documentation**
|
- **Documentation**
|
||||||
- [[Installing ZSH]]
|
- [[Installing ZSH]]
|
||||||
- [[Settings]]
|
- [[Settings]]
|
||||||
|
|||||||
130
scripts/experimental/generate_summaries.py
Executable file
130
scripts/experimental/generate_summaries.py
Executable file
@@ -0,0 +1,130 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Generate reports/summary.md and reports/summary.csv from `reports/` files.
|
||||||
|
|
||||||
|
Usage: python3 scripts/generate_summaries.py [--reports-dir reports]
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import csv
|
||||||
|
import argparse
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
|
def parse_report(path):
|
||||||
|
txt = ''
|
||||||
|
try:
|
||||||
|
with open(path, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
|
txt = f.read()
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def find(rx):
|
||||||
|
m = re.search(rx, txt)
|
||||||
|
return m.group(1).strip() if m else ''
|
||||||
|
|
||||||
|
return {
|
||||||
|
'Shows username': find(r'Shows username:\s*([^\n]+)'),
|
||||||
|
'Shows hostname': find(r'Shows hostname:\s*([^\n]+)'),
|
||||||
|
'Shows time/date': find(r'Shows time/date:\s*([^\n]+)'),
|
||||||
|
'Shows last command failure': find(r'Shows last command failure:\s*([^\n]+)'),
|
||||||
|
'PWD style': find(r'PWD style:\s*([^\n]+)'),
|
||||||
|
'Other info': find(r'Other info:\s*([^\n]+)'),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def write_atomic(path, data, mode='w', encoding='utf-8'):
|
||||||
|
dname = os.path.dirname(path) or '.'
|
||||||
|
fd, tmp = tempfile.mkstemp(dir=dname)
|
||||||
|
with os.fdopen(fd, mode, encoding=encoding) as f:
|
||||||
|
f.write(data)
|
||||||
|
f.flush(); os.fsync(f.fileno())
|
||||||
|
os.replace(tmp, path)
|
||||||
|
|
||||||
|
def generate_md(reports_dir,out_md,out_csv):
|
||||||
|
"""This will generate the Markdown file
|
||||||
|
|
||||||
|
Args:
|
||||||
|
reports_dir (str): directory of all reports
|
||||||
|
out_md (str): Where the markdown file will be created
|
||||||
|
out_csv (str): Where the CSV file will be created
|
||||||
|
"""
|
||||||
|
files = sorted([f for f in os.listdir(reports_dir) if os.path.isfile(os.path.join(reports_dir, f))])
|
||||||
|
rows = []
|
||||||
|
for fn in files:
|
||||||
|
# skip file if it has the name of the summary files
|
||||||
|
# or has extension .md or .csv(most likely are summary files)
|
||||||
|
if fn in (os.path.basename(out_md), os.path.basename(out_csv)) or fn.endswith(".csv") or fn.endswith(".md"): continue
|
||||||
|
path = os.path.join(reports_dir, fn)
|
||||||
|
parsed = parse_report(path)
|
||||||
|
if parsed is None:
|
||||||
|
continue
|
||||||
|
rows.append((fn, parsed))
|
||||||
|
# Markdown
|
||||||
|
md_lines = ['# Reports summary', '']
|
||||||
|
md_lines.append('| Report | Username | Hostname | Time/Date | Last Failure | PWD style | Other info |')
|
||||||
|
md_lines.append('|---|---:|---:|---:|---:|---|---|')
|
||||||
|
for fn, vals in rows:
|
||||||
|
md_lines.append('| {} | {} | {} | {} | {} | {} | {} |'.format(
|
||||||
|
fn,
|
||||||
|
vals.get('Shows username') or '-',
|
||||||
|
vals.get('Shows hostname') or '-',
|
||||||
|
vals.get('Shows time/date') or '-',
|
||||||
|
vals.get('Shows last command failure') or '-',
|
||||||
|
vals.get('PWD style') or '-',
|
||||||
|
vals.get('Other info') or '-'
|
||||||
|
))
|
||||||
|
md_text = '\n'.join(md_lines) + '\n'
|
||||||
|
write_atomic(out_md, md_text)
|
||||||
|
|
||||||
|
def generate_csv(reports_dir, out_md, out_csv):
|
||||||
|
files = sorted([f for f in os.listdir(reports_dir) if os.path.isfile(os.path.join(reports_dir, f))])
|
||||||
|
rows = []
|
||||||
|
for fn in files:
|
||||||
|
# skip summary files if present
|
||||||
|
if fn in (os.path.basename(out_md), os.path.basename(out_csv)) or fn.endswith(".csv") or fn.endswith(".md"): continue
|
||||||
|
path = os.path.join(reports_dir, fn)
|
||||||
|
parsed = parse_report(path)
|
||||||
|
if parsed is None:
|
||||||
|
continue
|
||||||
|
rows.append((fn, parsed))
|
||||||
|
# CSV
|
||||||
|
csv_path = out_csv
|
||||||
|
with tempfile.NamedTemporaryFile('w', delete=False, dir=os.path.dirname(csv_path), encoding='utf-8', newline='') as tmpf:
|
||||||
|
w = csv.writer(tmpf)
|
||||||
|
w.writerow(['Report','Shows username','Shows hostname','Shows time/date','Shows last command failure','PWD style','Other info'])
|
||||||
|
for fn, vals in rows:
|
||||||
|
w.writerow([
|
||||||
|
fn,
|
||||||
|
vals.get('Shows username') or '-',
|
||||||
|
vals.get('Shows hostname') or '-',
|
||||||
|
vals.get('Shows time/date') or '-',
|
||||||
|
vals.get('Shows last command failure') or '-',
|
||||||
|
vals.get('PWD style') or '-',
|
||||||
|
vals.get('Other info') or '-',
|
||||||
|
])
|
||||||
|
os.replace(tmpf.name, csv_path)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
p = argparse.ArgumentParser(description='Generate reports/summary.md and reports/summary.csv')
|
||||||
|
p.add_argument('--reports-dir', required=True, help='Directory containing report files')
|
||||||
|
p.add_argument('-m','--make-md',help="Enables creating a MD file",action='store_true')
|
||||||
|
p.add_argument('-c','--make-csv',help="Enables creating a csv file",action='store_true')
|
||||||
|
p.add_argument('--out-md', default=os.path.join('reports','summary.md'), help='Output markdown file')
|
||||||
|
p.add_argument('--out-csv', default=os.path.join('reports','summary.csv'), help='Output csv file')
|
||||||
|
args = p.parse_args()
|
||||||
|
|
||||||
|
reports_dir = args.reports_dir
|
||||||
|
if not os.path.isdir(reports_dir):
|
||||||
|
raise SystemExit(f'reports dir not found: {reports_dir}')
|
||||||
|
#generating files:
|
||||||
|
if args.make_csv:
|
||||||
|
generate_csv(reports_dir, args.out_md, args.out_csv)
|
||||||
|
print('WROTE', args.out_csv)
|
||||||
|
if args.make_md:
|
||||||
|
generate_md(reports_dir, args.out_md, args.out_csv)
|
||||||
|
print('WROTE', args.out_md)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
161
scripts/experimental/make_theme_reports.py
Executable file
161
scripts/experimental/make_theme_reports.py
Executable file
@@ -0,0 +1,161 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# The script goes through all the .zsh-thmes files and makes a dedicated file. with the theme's report.
|
||||||
|
# It is very possible that the scripts gets false positives.
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import tempfile
|
||||||
|
import argparse
|
||||||
|
# all ways to find things.
|
||||||
|
WAYS_TO_FIND={
|
||||||
|
"username": re.compile(r'%n'),
|
||||||
|
"hostname":re.compile(r'%m|%M|HOST|host_repr'),
|
||||||
|
"time":re.compile(r'%D|%T|%t|%\*'),
|
||||||
|
"last_failure":re.compile(r'%\?|%\(\?|%\?\)|RETVAL|RETURN|FAIL|ret_status'),
|
||||||
|
"pwd_num":re.compile(r'%([0-9]+)~'),
|
||||||
|
"pwd_basename":re.compile(r'%c'),
|
||||||
|
"pwd_short":re.compile(r'%~'),
|
||||||
|
"pwd_full":re.compile(r'%/|%d'),
|
||||||
|
"extra":{
|
||||||
|
"git":re.compile(r'git_prompt_info|git_prompt_status|git_prompt|vcs_branch|\bgit\b'),
|
||||||
|
"hg":re.compile(r'hg_prompt_info|\bhg\b|hg_prompt'),
|
||||||
|
"svn": re.compile(r'svn_prompt_info|\bsvn\b'),
|
||||||
|
"vcs_info":re.compile(r'vcs|VCS'),
|
||||||
|
"virtualenv":re.compile(r'VIRTUAL_ENV|virtualenv_prompt_info|virtualenv|CONDA_DEFAULT_ENV|conda_prompt'),
|
||||||
|
"ruby": re.compile(r'ruby_prompt_info|\bRVM\b|ruby_prompt|rvm'),
|
||||||
|
"fortune_commandlinefu":re.compile(r'fortune|commandlinefu|wget -qO-|curl -fsL'),
|
||||||
|
"history_number":re.compile(r'%!|%h'),
|
||||||
|
"root_indicator":re.compile(r'%#|%\(\!|UID\s*-eq\s*0|\$EUID\ \-ne\ 0|\"\$USERNAME"\ \=\ \"root\"|_LIBERTY\s*=.*#|\%\(\#\,'),
|
||||||
|
"aws":re.compile(r'AWS_PROFILE'),
|
||||||
|
"terraform":re.compile(r'tf_prompt_info|terraform'),
|
||||||
|
"vi-mode":re.compile(r'vi_mode_prompt_info|vi_mode'),
|
||||||
|
"kube":re.compile(r'kube_ps1|kube_prompt|kubernetes'),
|
||||||
|
'conda': re.compile(r'conda_prompt|CONDA_DEFAULT_ENV'),
|
||||||
|
'rvm': re.compile(r'ZSH_THEME_RVM_PROMPT_OPTIONS|rvm|RVM'),
|
||||||
|
'nodejs': re.compile(r'node_version_prompt|node_prompt_info|nvm'),
|
||||||
|
'battery': re.compile(r'battery_prompt_info|battery'),
|
||||||
|
'ssh_indicator': re.compile(r'ssh|SSH'),
|
||||||
|
'bzr': re.compile(r'bzr_prompt_info|\bbzr\b'),
|
||||||
|
'command_duration': re.compile(r'duration|cmd_timestamp'),
|
||||||
|
'jenv': re.compile(r'jenv_prompt_info|jenv'),
|
||||||
|
'customizable': re.compile(r'MLH'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class themes:
|
||||||
|
def __init__(self, name, conf,cfpath,repath):
|
||||||
|
"""this class contains all info about a theme
|
||||||
|
|
||||||
|
Args:
|
||||||
|
name (str): theme's name
|
||||||
|
conf (str): the contents of a theme's config file
|
||||||
|
path (str): the path of the config file
|
||||||
|
"""
|
||||||
|
self.name = name
|
||||||
|
self.config = conf
|
||||||
|
self.cfpath = cfpath
|
||||||
|
self.repath = repath
|
||||||
|
self.capabilities = {
|
||||||
|
"basic":{
|
||||||
|
"username":bool,
|
||||||
|
"hostname":bool,
|
||||||
|
"time":bool,
|
||||||
|
"last_failure":bool,
|
||||||
|
"pwd":str,
|
||||||
|
},
|
||||||
|
"extras":[]
|
||||||
|
}
|
||||||
|
self.fill_data()
|
||||||
|
def fill_data(self):
|
||||||
|
"""gathers all the info on the theme
|
||||||
|
"""
|
||||||
|
self.capabilities["basic"]["username"]=True if WAYS_TO_FIND["username"].search(self.config) else False
|
||||||
|
self.capabilities["basic"]["hostname"]=True if WAYS_TO_FIND["hostname"].search(self.config) else False
|
||||||
|
self.capabilities["basic"]["time"]=True if WAYS_TO_FIND["time"].search(self.config) else False
|
||||||
|
self.capabilities["basic"]["last_failure"]=True if WAYS_TO_FIND["last_failure"].search(self.config) else False
|
||||||
|
#pwd determination:
|
||||||
|
pwd_style='shortened path'
|
||||||
|
n=WAYS_TO_FIND["pwd_num"].search(self.config)
|
||||||
|
if n:
|
||||||
|
pwd_style=f'shortened path ({n.group(1)} folders)'
|
||||||
|
elif WAYS_TO_FIND["pwd_basename"].search(self.config):
|
||||||
|
pwd_style='basename (current directory name)'
|
||||||
|
elif WAYS_TO_FIND["pwd_short"].search(self.config):
|
||||||
|
pwd_style='shortened path'
|
||||||
|
elif WAYS_TO_FIND["pwd_full"].search(self.config):
|
||||||
|
pwd_style='full path'
|
||||||
|
self.capabilities["basic"]["pwd"]=pwd_style
|
||||||
|
#checking for the extras
|
||||||
|
#? theory: I will loop through the keys in WAYS_TO_FIND['extra'] in order to have the name of the tool
|
||||||
|
#? then i will verify if it applies. If it does, then I will add the key to the capabilities extra list.
|
||||||
|
for key in WAYS_TO_FIND['extra'].keys():
|
||||||
|
if WAYS_TO_FIND['extra'][key].search(self.config):
|
||||||
|
self.capabilities['extras'].append(key)
|
||||||
|
else:continue #sounded harder in my head.
|
||||||
|
def generate_report(self) -> str:
|
||||||
|
"""Generating the report, returns a string formated as a markdown list.
|
||||||
|
"""
|
||||||
|
extras=', '.join(self.capabilities["extras"]) if self.capabilities["extras"] else ''
|
||||||
|
lines=[
|
||||||
|
f"# Report for {self.name}",
|
||||||
|
f"- Name: {self.name}",
|
||||||
|
f"- Shows username: {self.capabilities["basic"]["username"]}",
|
||||||
|
f"- Shows hostname: {self.capabilities["basic"]["hostname"]}",
|
||||||
|
f"- Shows time/date: {self.capabilities["basic"]["time"]}",
|
||||||
|
f"- Shows last command failure: {self.capabilities["basic"]["last_failure"]}",
|
||||||
|
f"- PWD style: {self.capabilities["basic"]["pwd"]}",
|
||||||
|
f"- Other info: {extras}"
|
||||||
|
]
|
||||||
|
report='\n'.join(lines)+'\n'
|
||||||
|
return report
|
||||||
|
|
||||||
|
def main():
|
||||||
|
p = argparse.ArgumentParser(description='Generate reports/summary.md and reports/summary.csv')
|
||||||
|
p.add_argument('--reports-dir',required=True , help='Directory containing report files')
|
||||||
|
p.add_argument('--theme-dirs',required=True,help="Where theme files are. Multiple allowed",action="append")
|
||||||
|
p.add_argument('--alias',help="anykind of name change to be made. (wezm+ -> wezmplus) Multiple allowed",metavar="'b4:after'",action="append")
|
||||||
|
args = p.parse_args()
|
||||||
|
#making the aliases into something usefull.
|
||||||
|
alias={}
|
||||||
|
if args.alias:
|
||||||
|
for i in args.alias:
|
||||||
|
x=i.split(":", 2) #split the alias in a temp var
|
||||||
|
alias[x[0]]=x[1] #making the before be the key and the after be the value
|
||||||
|
#making documentation is harder then i thought ngl, i am not a programmer lol
|
||||||
|
themeDict: list[type[themes]]
|
||||||
|
themeDict=[]
|
||||||
|
#Looping through all theme directory
|
||||||
|
for theme_dir in args.theme_dirs:
|
||||||
|
#? step 1 - verify if dir actually exists
|
||||||
|
if not os.path.isdir(theme_dir):
|
||||||
|
continue
|
||||||
|
#? step 2 - loop through all files in dir
|
||||||
|
for theme in sorted(os.listdir(theme_dir)):
|
||||||
|
if not theme.endswith('.zsh-theme'): #verification that the file is actually a theme file
|
||||||
|
continue
|
||||||
|
#now i need to obtain the important data...
|
||||||
|
themeName=theme[:-10] #remove the file extension from name
|
||||||
|
if alias:
|
||||||
|
if themeName in alias.keys: themeName=alias[themeName]
|
||||||
|
themePath=os.path.join(theme_dir,theme)
|
||||||
|
rePath=os.path.join(args.reports_dir,themeName)
|
||||||
|
try:
|
||||||
|
with open(themePath,'r',errors='ignore') as fh:
|
||||||
|
themeConfig=fh.read()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to read config file: "+themePath)
|
||||||
|
print(e)
|
||||||
|
continue
|
||||||
|
#Now adding to the theme dict the class for the theme.
|
||||||
|
themeDict.append(themes(themeName,themeConfig,themePath,rePath))
|
||||||
|
for th in themeDict:
|
||||||
|
th.fill_data()
|
||||||
|
report=th.generate_report()
|
||||||
|
try:
|
||||||
|
with open(th.repath, "w") as f:
|
||||||
|
f.write(report)
|
||||||
|
except Exception as e:
|
||||||
|
print("failed write")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user