From 831461e91e4de0b8e7610f31d85ddc106e8ded55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gross?= Date: Tue, 21 Mar 2017 11:53:13 +0100 Subject: [PATCH] Add `enter` function for easier interaction with git repo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run a subshell with all git variables set. This can be used to easily interact with your git repository. This is also useful if you are using Emacs Tramp and magit to manage your directory. Signed-off-by: Sébastien Gross --- yadm | 9 ++++++++- yadm.1 | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/yadm b/yadm index f238575..9152f86 100755 --- a/yadm +++ b/yadm @@ -53,7 +53,7 @@ function main() { #; parse command line arguments local retval=0 - internal_commands="^(alt|bootstrap|clean|clone|config|decrypt|encrypt|help|init|list|perms|version)$" + internal_commands="^(alt|bootstrap|clean|clone|config|decrypt|encrypt|enter|help|init|list|perms|version)$" if [ -z "$*" ] ; then #; no argumnts will result in help() help @@ -408,6 +408,13 @@ function encrypt() { } +function enter() { + require_repo + echo "Entering repo" + $SHELL + echo "Leaving repo" +} + function git_command() { require_repo diff --git a/yadm.1 b/yadm.1 index c0e8db7..90727be 100644 --- a/yadm.1 +++ b/yadm.1 @@ -41,6 +41,8 @@ list .BR yadm " encrypt +.BR yadm " enter + .BR yadm " decrypt .RB [ -l ] @@ -176,6 +178,21 @@ Encrypt all files matching the patterns found in .IR $HOME/.yadm/encrypt . See the ENCRYPTION section for more details. .TP +.B enter +Run a subshell with all git variables set. This can be used to easily +interact with your git repository. This is also useful if you are using +Emacs Tramp and magit to manage your directory. You can add this +configuration in your emacs configuration: + +.RS + (add-to-list 'tramp-methods + '("yadm" + (tramp-login-program "yadm") + (tramp-login-args (("enter"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-c")))) +.RE +.TP .B gitconfig Pass options to the .B git config