From 067ac74d5fdbacf1cfdc44623b98b79aa1ad05d2 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 16 Oct 2010 11:09:21 +0200 Subject: Finish "ct new" --- bin/ct | 16 ++++++++++++++-- man/1/ct.pod | 6 ++++++ provides/zsh/completions/_ct | 7 +++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/bin/ct b/bin/ct index 5b87052..dbfaa60 100755 --- a/bin/ct +++ b/bin/ct @@ -266,7 +266,15 @@ function vcs_pull ( function vcs_push ( vcs_setup ${1} - git push + + # Repos created with "ct new" don't have a remote tracking branch yet. + # Detect this and fix it. + + if [[ $(git branch -r) == '' ]] { + git push origin master + } else { + git push + } ) function vcs_setup { @@ -853,8 +861,12 @@ function pkg_log { function pkg_new { + if [[ -z ${1} ]] { + die "Usage: ct new \n" + } + if list_exists ${1}; then - die "We already have a package with this name: ${1}" + die "We already have a package with this name: ${1}\n" fi pkgroot_setup ${PKG_ROOTS[1]} diff --git a/man/1/ct.pod b/man/1/ct.pod index 3a6a597..92e5658 100644 --- a/man/1/ct.pod +++ b/man/1/ct.pod @@ -55,6 +55,12 @@ show remote packages which are not installed Show commit history for package +=item B 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. + =item B [ I ] retrieve and install newest available version of I. diff --git a/provides/zsh/completions/_ct b/provides/zsh/completions/_ct index 767ccd1..8afb9af 100644 --- a/provides/zsh/completions/_ct +++ b/provides/zsh/completions/_ct @@ -7,7 +7,7 @@ typeset expl function _ct_action () { _wanted action expl 'action' \ compadd add debug eval remove info list \ - log pull push refresh status update + log new pull push refresh status update } function _ct_installed () { @@ -32,7 +32,7 @@ function _ct_args { _ct_installed ;; i|info) - _ct_all + _ct_all ;; a|add) _ct_notinstalled @@ -51,6 +51,9 @@ function _ct_args { _wanted mode expl 'update target' \ compadd local remote ;; + n|new) + _message 'New package name' + ;; *) _message 'no more arguments' ;; -- cgit v1.2.3