本站源代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.7KB

  1. <!doctype html>
  2. <title>CodeMirror: Shell mode</title>
  3. <meta charset="utf-8"/>
  4. <link rel=stylesheet href="../../doc/docs.css">
  5. <link rel=stylesheet href=../../lib/codemirror.css>
  6. <script src=../../lib/codemirror.js></script>
  7. <script src="../../addon/edit/matchbrackets.js"></script>
  8. <script src=shell.js></script>
  9. <style type=text/css>
  10. .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
  11. </style>
  12. <div id=nav>
  13. <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
  14. <ul>
  15. <li><a href="../../index.html">Home</a>
  16. <li><a href="../../doc/manual.html">Manual</a>
  17. <li><a href="https://github.com/codemirror/codemirror">Code</a>
  18. </ul>
  19. <ul>
  20. <li><a href="../index.html">Language modes</a>
  21. <li><a class=active href="#">Shell</a>
  22. </ul>
  23. </div>
  24. <article>
  25. <h2>Shell mode</h2>
  26. <textarea id=code>
  27. #!/bin/bash
  28. # clone the repository
  29. git clone http://github.com/garden/tree
  30. # generate HTTPS credentials
  31. cd tree
  32. openssl genrsa -aes256 -out https.key 1024
  33. openssl req -new -nodes -key https.key -out https.csr
  34. openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
  35. cp https.key{,.orig}
  36. openssl rsa -in https.key.orig -out https.key
  37. # start the server in HTTPS mode
  38. cd web
  39. sudo node ../server.js 443 'yes' &gt;&gt; ../node.log &amp;
  40. # here is how to stop the server
  41. for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do
  42. sudo kill -9 $pid 2&gt; /dev/null
  43. done
  44. exit 0</textarea>
  45. <script>
  46. var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
  47. mode: 'shell',
  48. lineNumbers: true,
  49. matchBrackets: true
  50. });
  51. </script>
  52. <p><strong>MIME types defined:</strong> <code>text/x-sh</code>, <code>application/x-sh</code>.</p>
  53. </article>
上海开阖软件有限公司 沪ICP备12045867号-1