commit:     face8293c75d9c7b837e11f67f90d657b167efc4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 16 15:30:30 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 16 15:30:30 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gentoo-syntax.git/commit/?id=face8293

newebuild: Improve eclass boilerplate

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 plugin/newebuild.vim | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/plugin/newebuild.vim b/plugin/newebuild.vim
index 7c5f46a..756b7f9 100644
--- a/plugin/newebuild.vim
+++ b/plugin/newebuild.vim
@@ -44,9 +44,20 @@ fun! <SID>MakeNewEbuild()
         put ='# ' . GentooGetUser()
         put ='# @AUTHOR:'
         put ='# ' . GentooGetUser()
+        put ='# @SUPPORTED_EAPIS: 8'
         put ='# @BLURB: '
         put ='# @DESCRIPTION:'
         put =''
+        let l:eclass_ident = substitute(toupper(l:eclass), "[^A-Z0-9]", "_", 
"g")
+        put ='if [[ ! ${_' . l:eclass_ident . '} ]]; then'
+        put =''
+        put ='case ${EAPI} in'
+        put =' 8) ;;'
+        put =' *) die \"EAPI ${EAPI} unsupported.\"'
+        put ='esac'
+        put =''
+        put ='_' . l:eclass_ident . '=1'
+        put ='fi'
         " }}}
 
         " {{{ go to the first thing to edit

Reply via email to