easy-aos
Version:
帮助配置arm-gcc开发环境,简化命令行。
74 lines (67 loc) • 1.47 kB
JavaScript
import i18n from "../../lib/i18n"
import platform from "../../config/platform/platform"
const t = new i18n("config")
const get_choices = function (arrs, top) {
let result = []
if (top) {
result.push({ title: top })
}
arrs.forEach(element => {
if (element != top) {
result.push({ title: element })
}
})
return result
}
const config = function (workspace) {
return [
{
type: "autocomplete",
name: "board",
message: `${t.__("Board")}: (${workspace.board})`,
choices: get_choices(platform.board_list, workspace.board)
},
{
type: "autocomplete",
name: "virtual_env",
message: `${t.__("Env")}: (${workspace.virtual_env})`,
choices: get_choices(["docker", "conda", "python"], workspace.virtual_env)
}
]
}
const aos_path = function (aos_path) {
return [
{
type: "text",
name: "path",
message: `${t.__("AOS_PATH")}: (${aos_path})`,
initial: `${aos_path}`
}
]
}
const app = function (workspace, app_name) {
return [
{
type: "text",
name: "app",
message: `${t.__("App")}: (${workspace.app})`,
initial: `${workspace.app || app_name}`
}
]
}
const isAosSource = function (workspace) {
return [
{
type: "confirm",
name: "isAosSource",
message: `${t.__("isAosSource")}: `,
initial: workspace.isAosSource,
}
]
}
export default {
isAosSource: isAosSource,
app: app,
aos_path: aos_path,
config: config
}