【问题标题】:jenkins how to activate syntax highlighting in "Build" -> "execute shell"jenkins 如何在“Build”->“execute shell”中激活语法高亮
【发布时间】:2014-06-12 21:04:14
【问题描述】:

我上个月安装了一次jenkins,我记得“Build”->“execute shell”字段中的shell脚本有语法高亮支持。

但是现在我今天重新安装了jenkins,没有更多的语法高亮。有人可以帮我吗?

我正在使用 jenkins ubuntu 1.566 版

【问题讨论】:

    标签: shell jenkins


    【解决方案1】:

    我通过参与ace editor 实现了这一目标。

    假设您已经安装了jQuery 插件和simple theme 插件,那么您可以添加这个脚本:

    Q(function() {
        // Append the ace editor script. Change it to your script location
        Q('body').append('<script src="/userContent/ace/src/ace.js">');
        // Search the textarea
        Q('textarea[name="command"]').each(function(index, textarea) {
            textarea = Q(textarea);
            id = 'editor_' + index
            // Hide the original textarea
            textarea.hide();
            // Create the editor div
            textarea.after('<div id="' + id + '"/>');
            // Setup the editor
            var editor = ace.edit(id);
            editor.setOptions({
                maxLines: Infinity,
                minLines: 5,
            });
            editor.getSession().setMode('ace/mode/sh');
            // Set initial value and create the event handler
            editor.getSession().setValue(textarea.val());
            editor.getSession().on('change', function() {
                textarea.val(editor.getSession().getValue());
            });
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-13
      • 1970-01-01
      • 2021-10-09
      • 1970-01-01
      • 2019-04-13
      相关资源
      最近更新 更多