我有以下YAML for tmuxinator:
# ~/.tmuxinator/st.yml
name: st
root: ~/learn/gnu-smalltalk
attach: false
# Runs before everything. Use it to start daemons etc.
on_project_start:
- emacs --daemon=gst --title=GST
- export EDITOR="emacsclient --server-file=gst -c -n"
- export VISUAL=$EDITOR
- $EDITOR &;
- gst-load -iI shampoo.im Shampoo
- gst-remote -I shampoo.im --daemon
- gst-remote -e "Shampoo.ShampooServer startOn: 9090 login: 'st' pass: 'st'"
on_project_exit:
- tmux -CC attach -t st
windows:
- console-emacs-dev:
- export EDITOR="emacsclient --server-file=gst -c -n"
- export VISUAL=$EDITOR
- echo "A currar"
- exercism:
- export EDITOR="emacsclient --server-file=gst -c -n"
- export VISUAL=$EDITOR
我有两个我无法解决的错误,首先是:
st.yml 14 61 error mapping values are not allowed in this context (yaml-ruby)
我试图逃脱角色':',
gst-remote -e "Shampoo.ShampooServer startOn: 9090 login\: 'st' pass\: 'st'"
但同样的情况发生了
和
- ->
gst-remote -e "Shampoo.ShampooServer startOn: 9090 login: 'st' pass: 'st'"
不起作用。
虽然YAML escape sequences是C语言的超集,但你仍然无法逃脱:
。
假设gst-remote
是通过一些shell执行的,你需要做的是逃避反斜杠:
gst-remote -e "Shampoo.ShampooServer startOn: 9090 login\\: 'st' pass\\: 'st'"
我不会尝试与&
,并假设有一个正在处理它的shell。而是使用emacsclient
的选项--no-wait
:
-n, --no-wait
returns immediately without waiting for you to "finish" the buf‐
fer in Emacs.
您还应该使用.yaml
作为YAML文件的扩展名。自2006年以来,它不仅是YAML的recommended extension,它还防止了与files in the YML format的混淆。
当字符串包含冒号+空格时,此错误是YAML语法错误中的已知错误,但在使用Ansible时,在读取the bug之后,对我有用的解决方案是在冒号字符':'之后对空格字符进行scape
- gst-remote -e "Shampoo.ShampooServer startOn:\s9090 login:\s'st' pass:\s'st'."
由此产生的YAML是:
# ~/.tmuxinator/st.yml
name: st
root: ~/learn/gnu-smalltalk
attach: false
# Runs before everything. Use it to start daemons etc.
on_project_start:
- emacs --daemon=gst --title=GST
- export EDITOR="emacsclient --server-file=gst -c -n"
- export VISUAL=$EDITOR
- $EDITOR
- gst-load -iI shampoo.im Shampoo
- gst-remote -I shampoo.im --daemon
- gst-remote -e "Shampoo.ShampooServer startOn:\s9090 login:\s'st' pass:\s'st'"
on_project_exit:
- tmux -CC attach -t st
windows:
- console-emacs-dev:
- export EDITOR="emacsclient --server-file=gst -c -n"
- export VISUAL=$EDITOR
- echo "A currar"
- exercism:
- export EDITOR="emacsclient --server-file=gst -c -n"
- export VISUAL=$EDITOR
Thay Yaml与Tmuxinator合作完美