From cc14672d25ec814d2db41e9b3a9376d1e2e57cd9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 18 Oct 2010 18:54:47 +0200 Subject: make "ct new " also work for existing packages --- bin/ct | 16 +++++++++------- man/1/ct.pod | 11 +++++++---- provides/zsh/completions/_ct | 5 ++++- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/bin/ct b/bin/ct index 79f37d0..f5f7100 100755 --- a/bin/ct +++ b/bin/ct @@ -867,19 +867,21 @@ function pkg_new { shift - if list_exists ${package}; then + if list_exists ${package} && [[ ${#} == 0 ]] ; then die "We already have a package with this name: ${package}\n" fi pkgroot_setup ${PKG_ROOTS[1]} - info "Creating local package...\n" - vcs_new ${package} + if ! list_exists ${package}; then + info "Creating local package...\n" + vcs_new ${package} - if [[ ${PKG_PROTO} == ssh ]] { - info "Creating remote package...\n" - ssh ${PKG_UAH} "GIT_DIR=${PKG_PATH}/${package} git --bare init" - } + if [[ ${PKG_PROTO} == ssh ]] { + info "Creating remote package...\n" + ssh ${PKG_UAH} "GIT_DIR=${PKG_PATH}/${package} git --bare init" + } + fi for file in ${*}; { diff --git a/man/1/ct.pod b/man/1/ct.pod index 5ae7743..7986528 100644 --- a/man/1/ct.pod +++ b/man/1/ct.pod @@ -55,11 +55,14 @@ show remote packages which are not installed Show commit history for package -=item B I +=item B I [ I ] -Create new I on the local and remote site. If you have more than one -package root, the first one is used. Note that this only works for SSH -package roots without forcecommand. +If I does not exist locally: Create it on the local and remote site. +If you have more than one package root, the first one is used. Note that this +only works for SSH package roots without forcecommand. + +If I are given, add them to the either newly created or already +installed package. Be aware that this feature is experimental. =item B [ I ] diff --git a/provides/zsh/completions/_ct b/provides/zsh/completions/_ct index 8afb9af..caa212c 100644 --- a/provides/zsh/completions/_ct +++ b/provides/zsh/completions/_ct @@ -52,7 +52,8 @@ function _ct_args { compadd local remote ;; n|new) - _message 'New package name' + _message 'New or existing package name' + _ct_installed ;; *) _message 'no more arguments' @@ -78,6 +79,8 @@ function _ct_args { _ct_notinstalled } elif [[ ${words[1]} == (rm|remove) ]] { _ct_installed + } elif [[ ${words[1]} == (n|new) ]] { + _files -W ${HOME} } } -- cgit v1.2.3