feat(tmux): add new project script
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -26,6 +26,7 @@ zsh/*
 | 
				
			|||||||
!tmux
 | 
					!tmux
 | 
				
			||||||
tmux/*
 | 
					tmux/*
 | 
				
			||||||
!tmux/tmux.conf
 | 
					!tmux/tmux.conf
 | 
				
			||||||
 | 
					!tmux/tmux-new-project
 | 
				
			||||||
!tmux/tmux-sessionizer
 | 
					!tmux/tmux-sessionizer
 | 
				
			||||||
!tmux/tmux-ggclone
 | 
					!tmux/tmux-ggclone
 | 
				
			||||||
!tmux/tmux-ssher
 | 
					!tmux/tmux-ssher
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [[ $# -eq 1 ]]; then
 | 
					if [[ $# -eq 1 ]]; then
 | 
				
			||||||
    selected=$1
 | 
					    selected=$1
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
@@ -11,5 +13,4 @@ if [[ -z $selected ]]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ggman clone "$selected"
 | 
					ggman clone "$selected"
 | 
				
			||||||
find -L $GGROOT -mindepth 1 -maxdepth 5 -type d -name .git -prune | xargs -n 1 dirname > "$GGROOT/compiled"
 | 
					ggcompile
 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										50
									
								
								tmux/tmux-new-project
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										50
									
								
								tmux/tmux-new-project
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,50 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ -z ${NAME:+x} ]]; then
 | 
				
			||||||
 | 
					    echo "missing name"
 | 
				
			||||||
 | 
					    sleep 2
 | 
				
			||||||
 | 
					    exit 1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					source "$XDG_CONFIG_HOME/zsh/scripts.zsh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					read -p "name: " project_name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ -z $project_name ]]; then
 | 
				
			||||||
 | 
					    exit 0
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [[ -d "$GGROOT/no-remote/$project_name" ]]; then
 | 
				
			||||||
 | 
					    exit 0
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					project="$GGROOT/no-remote/$project_name"
 | 
				
			||||||
 | 
					git init $project
 | 
				
			||||||
 | 
					echo "# $project_name" >>"$project/README.md"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					gitignore_template=$(
 | 
				
			||||||
 | 
					    find "$GGROOT"/github.com/github/gitignore/*.gitignore -exec basename {} \; \
 | 
				
			||||||
 | 
					        | sed 's/\(.*\)\.gitignore/\1/' \
 | 
				
			||||||
 | 
					        | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ! [[ -z $gitignore_template ]]; then
 | 
				
			||||||
 | 
					    gitignore="$GGROOT/github.com/github/gitignore/$gitignore_template.gitignore"
 | 
				
			||||||
 | 
					    echo "$gitignore"
 | 
				
			||||||
 | 
					    echo "$project/.gitignore"
 | 
				
			||||||
 | 
					    cat "$gitignore" >>"$project/.gitignore"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					license_template=$(
 | 
				
			||||||
 | 
					    find "$GGROOT"/git.janezic.dev/janezicmatej/license/*.license -exec basename {} \; \
 | 
				
			||||||
 | 
					        | sed 's/\(.*\)\.license/\1/' \
 | 
				
			||||||
 | 
					        | fzf --cycle --bind 'tab:toggle-up,btab:toggle-down'
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if ! [[ -z $license_template ]]; then
 | 
				
			||||||
 | 
					    license="$GGROOT/git.janezic.dev/janezicmatej/license/$license_template.license"
 | 
				
			||||||
 | 
					    export YEAR="$(date '+%Y')"
 | 
				
			||||||
 | 
					    envsubst <"$license" >"$project/LICENSE"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ggcompile
 | 
				
			||||||
@@ -37,4 +37,4 @@ bind-key F run-shell "tmux neww ~/.config/tmux/tmux-ssher"
 | 
				
			|||||||
bind-key T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp"
 | 
					bind-key T run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~/temp"
 | 
				
			||||||
bind-key R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~"
 | 
					bind-key R run-shell "tmux neww ~/.config/tmux/tmux-sessionizer ~"
 | 
				
			||||||
bind-key G run-shell "tmux neww ~/.config/tmux/tmux-ggclone"
 | 
					bind-key G run-shell "tmux neww ~/.config/tmux/tmux-ggclone"
 | 
				
			||||||
 | 
					bind-key N run-shell "tmux neww ~/.config/tmux/tmux-new-project"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user