aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-01-03 21:11:29 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-01-03 21:11:29 +0000
commit9f274cf7c39767b51655f695ea01344024aca78a (patch)
treef028b417f0b2560b63b87daf6c1d357cd80f2a43 /trunk
parent2a513cf4d421442f08b52184d2e078409f0bdac5 (diff)
downloadsimplepkg-9f274cf7c39767b51655f695ea01344024aca78a.tar.gz
simplepkg-9f274cf7c39767b51655f695ea01344024aca78a.tar.bz2
mkbuild: added --edit command line option
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@728 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rw-r--r--trunk/doc/CHANGELOG1
-rw-r--r--trunk/src/createpkg2
-rwxr-xr-xtrunk/src/mkbuild51
3 files changed, 46 insertions, 8 deletions
diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG
index 744ee03..ca17efa 100644
--- a/trunk/doc/CHANGELOG
+++ b/trunk/doc/CHANGELOG
@@ -28,6 +28,7 @@ simplepkg changelog
- default configuration making createpkg repository integrated with simplaret
- new repositories
- mkbuild:
+ - added --edit command line option
- code cleanup
- all previous "commit" functions and command line options changed to "submit" as they
don't really commit files into the svn repository
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index 4058a60..c1b2c77 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -543,7 +543,7 @@ case $1 in
[ $# -ne 2 ] && usage # two parameters is required
PKG_PATH=`find_slackbuild $2`
info_builds
- exit $EXIT_CODE
+ exit $EXIT_CODE
;;
'--install'|'-i')
[ $# -ne 2 ] && usage # two parameters is required
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index 11f0785..65c4c5b 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -90,6 +90,8 @@ ${red}DESCRIPTION${normal}
program version
${red}-V${normal}, ${red}--verbose${normal}
print debug information
+ ${red}-e${normal}, ${red}--edit${normal}
+ edit a mkbuild
${red}EXAMPLES${normal}
${red}mkbuild -sa pyrex.mkbuild${normal}
@@ -186,6 +188,12 @@ function set_parameters {
[ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--search <mkbuild_name>"
ACTION='search'
;;
+ '-e'|'--edit')
+ # Open mkbuild with $EDITOR
+ MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ [ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--edit <mkbuild_name>"
+ ACTION='edit'
+ ;;
'-d'|'--debug')
# Debug mode
set -x
@@ -1325,6 +1333,38 @@ function create_mkbuild {
}
+function search_mkbuild {
+
+ # find a given mkbuild
+ # usage: search_mkbuild
+
+ find $MKBUILDS_DIR -iname $MKBUILD_NAME
+
+}
+
+function edit_mkbuild {
+
+ # edit a mkbuild
+ # usage: edit_mkbuild
+
+ local match search="`search_mkbuild`"
+
+ if [ ! -z "$search" ]; then
+ for match in $search; do
+ # Edit the first matching mkbuild
+ if [ -z "$EDITOR" ]; then
+ EDITOR="vi"
+ fi
+ $EDITOR $match
+ break
+ done
+ else
+ echo "Not found: $MKBUILD_NAME"
+ return 1
+ fi
+
+}
+
# ----------------------------------------------------------------
#=============================
@@ -1404,13 +1444,10 @@ if [ ! -z "$MKBUILD_NAME" ]; then
make_slackbuild
;;
'search')
- SEARCH=`find $MKBUILDS_DIR -iname $MKBUILD_NAME`
- if [ "$SEARCH" == "" ]; then
- EXIT_CODE=1
- else
- EXIT_CODE=0
- echo $SEARCH
- fi
+ search_mkbuild
+ ;;
+ 'edit')
+ edit_mkbuild
;;
esac
fi