]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
adding more snippets
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 17 May 2017 13:32:41 +0000 (15:32 +0200)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Wed, 17 May 2017 13:32:41 +0000 (15:32 +0200)
* ami-ls to list aws ami images
* hiera_ to define puppet variables referencing hiera.
* var_ to reference variables in erb templates.

Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
snippets/eshell-mode/ami-ls [new file with mode: 0644]
snippets/puppet-mode/hiera [new file with mode: 0644]
snippets/rhtml-mode/var [new file with mode: 0644]

diff --git a/snippets/eshell-mode/ami-ls b/snippets/eshell-mode/ami-ls
new file mode 100644 (file)
index 0000000..2c6ad30
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: ami-ls
+# key: ami-ls
+# --
+aws --profile=${1:$$(yas-choose-value bba-aws-profiles)} ${2:--region=${3:$$(yas-choose-value bba-aws-regions)}} ec2 describe-images --owners \$`(if (string-equal major-mode "eshell-mode")(insert-string "{")(insert-string "("))` aws --profile=$1  ec2 describe-security-groups --group-names 'Default' --query 'SecurityGroups[0].OwnerId' --output text `(if (string-equal major-mode "eshell-mode")(insert-string "}")(insert-string ")"))` --query "reverse(sort_by(Images, &CreationDate)[].{CreationDate:CreationDate,Name:Name,ImageId:ImageId,Public:Public,Description:Description})" --output ${4:$$(yas-choose-value '("text" "table" "json"))} $0
\ No newline at end of file
diff --git a/snippets/puppet-mode/hiera b/snippets/puppet-mode/hiera
new file mode 100644 (file)
index 0000000..f9e17f6
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: hiera
+# key: hiera_
+# --
+$$1 = hiera('${2:`(insert-string (file-name-nondirectory (replace-regexp-in-string "/[^/]*/$" "" (file-name-directory (buffer-file-name)))))`}::${3:$1}', ${4:undef})$0
\ No newline at end of file
diff --git a/snippets/rhtml-mode/var b/snippets/rhtml-mode/var
new file mode 100644 (file)
index 0000000..5851bcf
--- /dev/null
@@ -0,0 +1,5 @@
+# -*- mode: snippet -*-
+# name: var
+# key: var_
+# --
+<%= @$1 %>$0
\ No newline at end of file