对于tmuxinator,我有以下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: 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'"但同样的事情也会发生
不起作用。
发布于 2019-04-29 16:28:04
尽管YAML escape sequences是C语言的超集,但您仍然无法摆脱:。
假设gst-remote是通过某个外壳执行的,您需要做的就是转义反斜杠:
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的混淆。
发布于 2019-05-01 14:59:31
当字符串包含冒号+空格时,这个错误是YAML语法错误中的一个已知问题,但是当使用Ansible时,在读取the bug之后,有效的解决方案是在tmuxinator it was a problem中设置冒号字符':‘后面的空格字符。
- gst-remote -e "Shampoo.ShampooServer startOn:\s9090 login:\s'st' pass:\s'st'."这适用于ansible/phyton,但不适用于ruby/tmuxinator
这个解决方案对我不起作用,我试图转义字符串中的空格,\s,甚至\u0020,都没有起作用。最后一件事是阅读这两篇文章,似乎ruby和python以不同的方式使用了这个字符串,对于ruby我有时会收到这个错误,undefined method外壳转义‘for Hash`。
所以我继续寻找
Explanation YAML 2
从第一个链接开始:
普通标量(值域)不能包含“:”和“#”字符组合。这样的组合会导致映射键:值对和注释的歧义。
此外,在流集合内,或用作隐式键时,普通标量不能包含“”、“”、“{”、“}”和“,”字符。这些字符将导致流集合结构的歧义。
您可以尝试以下选项:
YAML
'http://www.example-site.com/'
|-
:
所以最后的yaml文件是:
# ~/.tmuxinator/st.yaml
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 -V -I shampoo.im --daemon
- >-
gst-remote -V -e "Shampoo.ShampooServer startOn: 9092 login: 'toni' pass: 'toni'."
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=$EDITORhttps://stackoverflow.com/questions/55898747
复制相似问题