go get github.com/mitsutaka/zcmd/pkg/z
z
rsync
wrapper command for servers. It plans replace it with Go native sync library.
z sync pull
: Pull files from the remote server in parallel.z sync push
: Push files to the remote server in parallel.
Command line flag can append additional rsync flags. Default rsync flags are -avzP --stats --delete --delete-excluded
.
Configuration example $HOME/.z.yaml
:
sync:
# Config for pulling
pull:
# It uses when command runs with particular path
- name: movie
# Source URL for pulling
source: RSYNC_URL
# Destination directory
destination: /mnt/nas/movie
- name: picture
source: RSYNC_URL
destination: /mnt/nas/picture
# Exclude pattern
excludes:
- xxxx
- yyyy
# Config for pushing
push:
- name: music
source: /mnt/nas/music
destination: RSYNC_URL
excludes:
- zzzz
- name: fuse
source: /home/mitz/Documents
destination: LOCAL_PATH
# Some cases should disable sudo with fuse mounts
disable_sudo: true
rsync
wrapper command for backup.
z backup
: Run backup to the remote server in parallel.
Command line flag can append additional rsync flags. Default rsync flags are -avzP --stats --delete
.
Configuration example $HOME/.z.yaml
:
backup:
# Backup URLs
destinations:
- rsync://BACKUP_URL
# Include backup paths
includes:
- /
- /boot
- /home
# Exclude paths and pattern
excludes:
- .cache/
- /dev
- /media
- /misc
- /mnt
- /proc
- /run
- /sys
- /var/cache
Run git clean
, git checkout master
and git pull
for checked out git repositories.
Configuration example $HOME/.z.yaml
:
repos:
# Root directory of the git repositories
root: /your/root/git/repos
dotfiles manager inspired by https://github.com/dotphiles/dotphiles
z dotfiles init GITURL
: Initialize dotfiles in local.z dotfiles pull
: Download latest dotfiles and make symbolic links.
dotfiles:
# default is $HOME/.zdotfiles
dir: /home/mitz/.zdotfiles
hosts:
- YOUR_HOSTNAME
files:
- bashrc
- config/sway/config
- spacemacs
- ssh
NOT IMPLEMENTED YET
Make multiple ssh port forward at once.
z proxy
: Setup ssh port forward.
proxy:
- name: testforward1
user: ubuntu
address: remotehost1
private_key: ~/.ssh/id_rsa
forward:
# Local forwarding
- type: local
# default bindAddress is *
bind_pddress: localhost
bind_port: 13128
remote_address: localhost
remote_port: 3128
# Dynamic forwarding for SOCK4, 5
- type: dynamic
bind_address: localhost
bind_port: 1080
- name: testforward2
user: admin
address: remotehost2
private_key: ~/.ssh/id_ecdsa
port: 10000
forward:
# Remote forwarding
- type: remote
bind_address: localhost
bind_port: 9000
remote_address: localhost
remote_port: 3000
To load bash completion scripts, run:
. <(z completion)
MIT