update doots

This commit is contained in:
riley 2021-10-19 23:09:24 -04:00
parent e9f966929e
commit 76ac48fa92
4 changed files with 53 additions and 29 deletions

4
.vimrc
View file

@ -39,7 +39,7 @@ set splitright
"nnoremap <C-H> <C-W><C-H>
"formatting
set tabstop=4
set tabstop=2
set softtabstop=0 noexpandtab
set shiftwidth=4
@ -55,7 +55,7 @@ set number
nnoremap <C-t> :NERDTreeToggle<CR>
"Language server junk
let g:lsc_server_commands = {'py': 'pyls'}
let g:lsc_server_commands = {'py': 'pyls', 'xsh': 'pyls'}
let g:lsc_auto_map = v:true

View file

@ -5,12 +5,17 @@ xontrib load apt_tabcomplete argcomplete autovox jedi z
# path stuff
$PATH.insert(0, '')
$PATH.extend([
'~/addins',
'~/.local/bin',
'~/bin',
])
def load_path():
import sys
$PATH.extend([
'~/addins',
'~/.local/bin',
'~/bin',
'~/go/bin'
])
sys.path.insert(0, '')
load_path()
import addins # my extra stuffs :p
@ -37,16 +42,20 @@ def _debug():
print("Debug mode enabled.")
# bitwarden shit
def _bwc(object : str, id : str):
def _bwc(object : str, bw_id: str):
if p'~/.bw_session'.exists():
if $XONSH_SHOW_TRACEBACK:
print("loaded .bw_session")
source ~/.bw_session
else:
raise FileNotFoundError("~/.bw_session")
output = $(bw get @(object) @(id))
output = $(bw get @(object) @(bw_id))
$(echo @(output) | xclip -sel clipboard)
return output
if "password" in object and !(bw get totp @(object[1]) a> /dev/null):
input("totp found, press any key to copy totp ")
output = $(bw get totp @(object[1]))
$(echo @(output) | xclip -sel clipboard)
# return output
# aliases
aliases.update({
@ -57,6 +66,7 @@ aliases.update({
'debug': _debug,
'ls': 'ls -alhs --color=auto',
':q': 'exit',
'owo': 'echo uwu',
})
# man page colors :O

View file

@ -1,4 +1,4 @@
from .version import *
from .package import *
from .version import Version
from .package import Package
__all__ = ['Version', 'Package']

View file

@ -1,21 +1,35 @@
import platform
from pathlib import Path
__all__ = ['Version']
class Version:
def __init__(self):
data = self._load_dict()
for key, value in data.items():
setattr(self, key.lower(), value)
if hasattr(self, "id_like"): # special handling for ID_LIKE
self.id_like = self.id_like.split()
class Platform:
def __init__(self):
self.architecture = platform.architecture()
self.machine = platform.machine()
self.node = platform.node()
self.platform = platform.platform()
self.processor = platform.processor()
self.release = platform.release()
self.system = platform.system()
self.version = platform.version()
def _load_dict(self):
data = {}
os_files = Path('/etc').glob("*-release")
for i in os_files:
with i.open() as f:
for line in f:
line = line.split("=")
data[line[0]] = line[1].strip().replace('"', '')
return data
class Version:
def __init__(self):
data = self._load_dict()
for key, value in data.items():
setattr(self, key.lower(), value)
if hasattr(self, "id_like"): # special handling for ID_LIKE
self.id_like = self.id_like.split()
if not hasattr(self, "platform"):
self.platform = Platform()
def _load_dict(self):
data = {}
os_files = Path('/etc').glob("*-release")
for i in os_files:
with i.open() as f:
for line in f:
line = line.split("=")
data[line[0]] = line[1].strip().replace('"', '')
return data