2017-09-17 2 views
1

J'avais l'habitude d'utiliser le système de construction dans Sublime texte où je pourrais ajouter mes propres systèmes de construction de personnaliser. Par exemple, pour Clisp, je créé un système de construction en tant que tel:Exécution de scripts avec des conditions spéciales dans Atom

{ 
    "cmd": ["clisp", "-q", "-modern", "-L", "french", "$file"], 
    "selector": "source.lisp" 
} 

De même, j'avais une coutume pour un C:

{ 
"cmd" : ["gcc $file_name -Wall -o ${file_base_name} && ./${file_base_name}"], 
"selector" : "source.c", 
"shell": true, 
"working_dir" : "$file_path" 
} 

Comment puis-je faire dans Atom?

+0

S'il vous plaît venez dire utiliser votre expérience lorsque vous avez terminé sur https://www.reddit.com/r/lisp/ :) – Ehvince

Répondre

2

Pour tthat atome de travail a un joli paquet appelé Atom package Build, vous pouvez le trouver ici: https://github.com/noseglid/atom-build

Il utilise javascript est ici un exemple pour:

module.exports = { 
    cmd: 'make', 
    name: 'Makefile', 
    sh: true, 
    functionMatch: function (output) { 
    const enterDir = /^make\[\d+\]: Entering directory '([^']+)'$/; 
    const error = /^([^:]+):(\d+):(\d+): error: (.+)$/; 
    // this is the list of error matches that atom-build will process 
    const array = []; 
    // stores the current directory 
    var dir = null; 
    // iterate over the output by lines 
    output.split(/\r?\n/).forEach(line => { 
     // update the current directory on lines with `Entering directory` 
     const dir_match = enterDir.exec(line); 
     if (dir_match) { 
     dir = dir_match[1]; 
     } else { 
     // process possible error messages 
     const error_match = error.exec(line); 
     if (error_match) { 
      // map the regex match to the error object that atom-build expects 
      array.push({ 
      file: dir ? dir + '/' + error_match[1] : error_match[1], 
      line: error_match[2], 
      col: error_match[3], 
      message: error_match[4] 
      }); 
     } 
     } 
    }); 
    return array; 
    } 
};