jenkins如何激活"Build"中的语法高亮显示-> “执行外壳" [英] jenkins how to activate syntax highlighting in "Build" -> "execute shell"

查看:105
本文介绍了jenkins如何激活"Build"中的语法高亮显示-> “执行外壳"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我上个月安装了一次jenkins,我记得构建"->执行外壳"字段中的shell脚本具有语法高度支持.

I have installed once jenkins last month, and I remember the shell script in the field "Build" -> "execute shell" has syntax highlighing support.

但是现在我今天已经重新安装了jenkins,没有其他语法高亮显示.有没有人可以在这里帮助我?

But Now I have reinstalled jenkins today, there is no more syntax highlighting. Is there anybody can help me here?

我正在使用jenkins ubuntu 1.566版

I'm using jenkins ubuntu version 1.566

推荐答案

我通过涉及 ace编辑器.

假设您具有 jQuery 插件和简单主题插件,然后您可以添加以下脚本:

Assume you have the jQuery plugin and the simple theme plugin installed then you could add this script:

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());
        });
    });
});

这篇关于jenkins如何激活"Build"中的语法高亮显示-&gt; “执行外壳"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆