Skip to content

Commit

Permalink
Add click to install.xsh
Browse files Browse the repository at this point in the history
See #1.
  • Loading branch information
ruivieira committed Aug 14, 2022
1 parent f69d608 commit 7912590
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 23 deletions.
76 changes: 53 additions & 23 deletions install.xsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,27 @@
from abc import ABC, abstractmethod
from pathlib import Path
import os
import click

# Install robby xontrib
xpip install ~/Sync/code/robby/robby -U --force
@click.group()
def setup():
"""
Manage setup
"""
pass

@setup.group()
def install():
"""
Install software
"""
pass


@install.command("robby")
def install_robby():
"""Install robby xontrib"""
xpip install ~/Sync/code/robby/robby -U --force

import xontrib.xlog as l

Expand All @@ -21,6 +39,11 @@ if OS=="Darwin":

class Item(ABC):
def install(self):
if not self.installed():
print_color("[🐚] {GREEN}Installing " + self._info() + "{RESET}")
else:
print_color("[🐚] {YELLOW}" + self._info() + " already installed{RESET}")

if OS=="Darwin":
self._darwin()
else:
Expand Down Expand Up @@ -294,29 +317,36 @@ class Zsh(Item):

def _linux(self):
l.info("Installing .zshrc")
# cp ./rc/.zshrc ~/.zshrc
cp ./rc/.zshrc ~/.zshrc

def _info(self):
return "zsh"

items = [XonshRc(),
Todoist(),
Fonts(),
Kitty(),
DevTools(),
NeoVim(),
KeepassXC(),
EnvFile(),
EmacsSecrets(),
Mu(),
Rust(),
Nim(),
Zsh()]

for item in items:
@install.command("zsh")
def install_zsh():
"""Install zsh and configuration"""
Zsh().install()

# items = [XonshRc(),
# Todoist(),
# Fonts(),
# Kitty(),
# DevTools(),
# NeoVim(),
# KeepassXC(),
# EnvFile(),
# EmacsSecrets(),
# Mu(),
# Rust(),
# Nim(),
# Zsh()]

# for item in items:

if not item.installed():
print_color("[🐚] {GREEN}Installing " + item._info() + "{RESET}")
item.install()
else:
print_color("[🐚] {YELLOW}" + item._info() + " already installed{RESET}")
# if not item.installed():
# print_color("[🐚] {GREEN}Installing " + item._info() + "{RESET}")
# item.install()
# else:
# print_color("[🐚] {YELLOW}" + item._info() + " already installed{RESET}")
if __name__ == "__main__":
setup()
69 changes: 69 additions & 0 deletions rc/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh

ZSH_THEME="gruvbox"
SOLARIZED_THEME="dark"

# Set to this to use case-sensitive completion
CASE_SENSITIVE="false"

# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"

# aliases
alias 'ls'='exa -l --icons'
alias 'cd..'='cd ..'
alias 'dir'='exa -l --icons'
alias 'tree'="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
alias '..'='cd ..'

ROBBY_DIR=${HOME}/Sync/code/robby

alias notes=${ROBBY_DIR}/robby/xontrib/notes.xsh
alias humble=${ROBBY_DIR}/robby/xontrib/humble.xsh

plugins=(emoji git macos mvn rust zsh-autosuggestions history-substring-search zsh-syntax-highlighting zsh-z)

source $ZSH/oh-my-zsh.sh

# aliases
if [ -f $HOME/.aliasrc ]; then
source $HOME/.aliasrc
fi

# function
if [ -f $HOME/.functions.zsh ]; then
source $HOME/.functions.zsh
fi

###-tns-completion-start-###
if [ -f $HOME/.tnsrc ]; then
source $HOME/.tnsrc
fi
###-tns-completion-end-###

# set a more comprehensive format for `time`
TIMEFMT='%J %U user %S system %P cpu %*E total'$'\n'\
'avg shared (code): %X KB'$'\n'\
'avg unshared (data/stack): %D KB'$'\n'\
'total (sum): %K KB'$'\n'\
'max memory: %M MB'$'\n'\
'page faults from disk: %F'$'\n'\
'other page faults: %R'

PROMPT='$(random_emoji animals)':$PROMPT

ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY=""
ZSH_THEME_GIT_PROMPT_CLEAN=""

# git editor
EDITOR=/usr/local/bin/code

# Deno variables
export DENO_INSTALL=$HOME/.deno
export PATH="$DENO_INSTALL/bin:$PATH"

# eval "$(starship init zsh)"
# eval "$(navi widget zsh)"

0 comments on commit 7912590

Please sign in to comment.