如何从CoffeeScript脚本中启动CoffeeScript复制?

编程入门 行业动态 更新时间:2024-10-16 00:24:56
本文介绍了如何从CoffeeScript脚本中启动CoffeeScript复制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我这样做

repl = require 'repl' repl.start {useGlobal: true}

它启动一个Node repl。

It starts a Node repl. How do I start a CoffeeScript repl instead?

感谢

推荐答案

Nesh是一个尝试,使其更容易和可扩展的项目:

Nesh is a project to try and make this a bit easier and extensible:

danielgtaylor.github/nesh/

它提供了嵌入REPL并支持多种语言(如CoffeeScript)的方法以及提供异步插件架构,支持在启动时在REPL的上下文中执行代码等。例如:

It provides a way to embed a REPL with support for multiple languages like CoffeeScript as well as providing an asyncronous plugin architecture, support to execute code in the context of the REPL on startup, etc. For example:

nesh = require 'nesh' nesh.loadLanguage 'coffee' nesh.start (err, repl) -> nesh.log.error err if err

它还支持一系列选项默认插件,并公开一些内置的方便功能:

It also supports a bunch of options with the default plugins and exposes some built-in convenience functions as well:

opts = welcome: 'Welcome to my interpreter!' prompt: '> ' evalData: CoffeeScriptpile 'hello = (name="world") -> "Hello, #{world}!"', {bare: true} nesh.start opts, (err, repl) -> nesh.log.error err if err

更多推荐

如何从CoffeeScript脚本中启动CoffeeScript复制?

本文发布于:2023-11-28 18:15:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643444.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   CoffeeScript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!