/scripts/shBrushBash.js

http://github.com/alexgorbatchev/SyntaxHighlighter · JavaScript · 43 lines · 36 code · 5 blank · 2 comment · 5 complexity · 818047fa38009b035b45321b81bf766d MD5 · raw file

  1. ;(function()
  2. {
  3. // CommonJS
  4. SyntaxHighlighter = SyntaxHighlighter || (typeof require !== 'undefined'? require('shCore').SyntaxHighlighter : null);
  5. function Brush()
  6. {
  7. var keywords = 'if fi then elif else for do done until while break continue case esac function return in eq ne ge le';
  8. var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
  9. 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
  10. 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
  11. 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
  12. 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
  13. 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
  14. 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
  15. 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
  16. 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
  17. 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
  18. 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
  19. 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
  20. 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
  21. 'vi watch wc whereis which who whoami Wget xargs yes'
  22. ;
  23. this.regexList = [
  24. { regex: /^#!.*$/gm, css: 'preprocessor bold' },
  25. { regex: /\/[\w-\/]+/gm, css: 'plain' },
  26. { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
  27. { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
  28. { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
  29. { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
  30. { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
  31. ];
  32. }
  33. Brush.prototype = new SyntaxHighlighter.Highlighter();
  34. Brush.aliases = ['bash', 'shell', 'sh'];
  35. SyntaxHighlighter.brushes.Bash = Brush;
  36. // CommonJS
  37. typeof(exports) != 'undefined' ? exports.Brush = Brush : null;
  38. })();