ពាក្យបញ្ជាផ្ទាល់ខ្លួន
កំណត់ពាក្យបញ្ជាផ្ទាល់ខ្លួននិងប្លង់ workspace ដោយបន្ថែមឯកសារ cmux.json ទៅឫសគម្រោងរបស់អ្នក ឬ ~/.config/cmux/។ ពាក្យបញ្ជាលេចឡើងក្នុងបន្ទះពាក្យបញ្ជា។
ទីតាំងឯកសារ
cmux រកការកំណត់រចនាសម្ព័ន្ធនៅ២កន្លែង:
- តាមគម្រោង:
./cmux.json— ស្ថិតក្នុងថតគម្រោងរបស់អ្នក, មានអាទិភាព - សាកល:
~/.config/cmux/cmux.json— អនុវត្តចំពោះគម្រោងទាំងអស់, បំពេញពាក្យបញ្ជាដែលមិនបានកំណត់ក្នុងតំបន់
ការផ្លាស់ប្ដូរត្រូវបានទទួលស្គាល់ដោយស្វ័យប្រវត្តិ — មិនចាំបាច់ចាប់ផ្ដើមឡើងវិញ។
ស្គីម៉ា
ឯកសារ cmux.json មានអារ៉េ commands។ ពាក្យបញ្ជានីមួយៗគឺជាពាក្យបញ្ជា shell សាមញ្ញ ឬនិយាមព workspace ពេញលេញ:
{
"commands": [
{
"name": "Start Dev",
"keywords": ["dev", "start"],
"workspace": { ... }
},
{
"name": "Run Tests",
"command": "npm test",
"confirm": true
}
]
}ពាក្យបញ្ជាសាមញ្ញ
ពាក្យបញ្ជាសាមញ្ញដំណើរការពាក្យបញ្ជា shell ក្នុងទែមីណាលដែលបានផ្ដោតបច្ចុប្បន្ន:
{
"commands": [
{
"name": "Run Tests",
"keywords": ["test", "check"],
"command": "npm test",
"confirm": true
}
]
}វាល
name— បង្ហាញក្នុងបន្ទះពាក្យបញ្ជា (ចាំបាច់)description— ការពិពណ៌នាជាជម្រើសkeywords— ពាក្យស្វែងរកបន្ថែមសម្រាប់បន្ទះពាក្យបញ្ជាcommand— ពាក្យបញ្ជា shell ដំណើរការក្នុងទែមីណាលដែលបានផ្ដោតconfirm— បង្ហាញប្រអប់បញ្ជាក់មុននឹងដំណើរការ
ពាក្យបញ្ជាសាមញ្ញដំណើរការក្នុងថតការងារបច្ចុប្បន្នរបស់ terminal ដែលកំពុងផ្ដោត។ ប្រសិនបើពាក្យបញ្ជារបស់អ្នកពឹងផ្អែកលើផ្លូវទាក់ទងនឹងគម្រោង សូមបន្ថែមពីមុខ cd "$(git rev-parse --show-toplevel)" && ដើម្បីដំណើរការពីឫសនៃ repo ឬ cd /your/path && សម្រាប់ថតណាមួយជាក់លាក់។
ពាក្យបញ្ជា workspace
ពាក្យបញ្ជា workspace បង្កើត workspace ថ្មីជាមួយប្លង់ផ្ទាល់ខ្លួននៃការបំបែក, ទែមីណាល, និងបន្ទះកម្មវិធីរុករក:
{
"commands": [
{
"name": "Dev Environment",
"keywords": ["dev", "fullstack"],
"restart": "confirm",
"workspace": {
"name": "Dev",
"cwd": ".",
"layout": {
"direction": "horizontal",
"split": 0.5,
"children": [
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Frontend",
"command": "npm run dev",
"focus": true
}
]
}
},
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Backend",
"command": "cargo watch -x run",
"cwd": "./server",
"env": { "RUST_LOG": "debug" }
}
]
}
}
]
}
}
}
]
}វាល workspace
name— ឈ្មោះផ្ទាំង workspace (លំនាំដើមគឺឈ្មោះពាក្យបញ្ជា)cwd— ថតការងារសម្រាប់ workspacecolor— ពណ៌ផ្ទាំង workspacelayout— ដើមប្លង់ដែលកំណត់ការបំបែកនិងបន្ទះ
ឥរិយាបថចាប់ផ្ដើមឡើងវិញ
គ្រប់គ្រងអ្វីដែលកើតឡើងនៅពេល workspace ដែលមានឈ្មោះដូចគ្នារួចមានស្រាប់:
"ignore"— ប្ដូរទៅ workspace ដែលមានស្រាប់ (លំនាំដើម)"recreate"— បិទហើយបង្កើតឡើងវិញដោយមិនសួរ"confirm"— សួរអ្នកប្រើប្រាស់មុននឹងបង្កើតឡើងវិញ
ដើមប្លង់
ដើមប្លង់កំណត់របៀបដែលបន្ទះត្រូវបានរៀបចំដោយប្រើថ្នាំងការបំបែករៀងគ្នា:
ថ្នាំងការបំបែក
ចែកចន្លោះទៅជាកូន២:
direction—"horizontal"ឬ"vertical"split— ទីតាំងខ្សែបំបែកពី 0.1 ដល់ 0.9 (លំនាំដើម 0.5)children— ថ្នាំងកូនពិតប្រាកដ២ (ការបំបែក ឬបន្ទះ)
ថ្នាំងបន្ទះ
ថ្នាំងស្លឹកមួយដែលមាន surface មួយ ឬច្រើន (ផ្ទាំងនៅក្នុងបន្ទះ)។
និយាម surface
surface នីមួយៗក្នុងបន្ទះអាចជាទែមីណាល ឬកម្មវិធីរុករក:
type—"terminal"ឬ"browser"name— ចំណងជើងផ្ទាំងផ្ទាល់ខ្លួនcommand— ពាក្យបញ្ជា shell ដំណើរការដោយស្វ័យប្រវត្តិពេលបង្កើត (ទែមីណាលតែប៉ុណ្ណោះ)cwd— ថតការងារសម្រាប់ surface នេះenv— អថេរបរិស្ថានជាគូ key-valueurl— URL ដែលត្រូវបើក (កម្មវិធីរុករកតែប៉ុណ្ណោះ)focus— ផ្ដោតលើ surface នេះបន្ទាប់ពីបង្កើត
ការដោះស្រាយថតការងារ
.ឬ លុបចោល — ថតការងារ workspace./subdir— ទាក់ទងនឹងថតការងារ workspace~/path— ពង្រីកទៅថតផ្ទះ- ផ្លូវដាច់ខាត — ប្រើដូចដែលមាន
ឧទាហរណ៍ពេញលេញ
{
"commands": [
{
"name": "Web Dev",
"description": "Docs site with live preview",
"keywords": ["web", "docs", "next", "frontend"],
"restart": "confirm",
"workspace": {
"name": "Web Dev",
"cwd": "./web",
"color": "#3b82f6",
"layout": {
"direction": "horizontal",
"split": 0.5,
"children": [
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Next.js",
"command": "npm run dev",
"focus": true
}
]
}
},
{
"direction": "vertical",
"split": 0.6,
"children": [
{
"pane": {
"surfaces": [
{
"type": "browser",
"name": "Preview",
"url": "http://localhost:3777"
}
]
}
},
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Shell",
"env": { "NODE_ENV": "development" }
}
]
}
}
]
}
]
}
}
},
{
"name": "Debug Log",
"description": "Tail the debug event log from the running dev app",
"keywords": ["log", "debug", "tail", "events"],
"restart": "ignore",
"workspace": {
"name": "Debug Log",
"layout": {
"direction": "horizontal",
"split": 0.5,
"children": [
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Events",
"command": "tail -f /tmp/cmux-debug.log",
"focus": true
}
]
}
},
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Shell"
}
]
}
}
]
}
}
},
{
"name": "Setup",
"description": "Initialize submodules and build dependencies",
"keywords": ["setup", "init", "install"],
"command": "./scripts/setup.sh",
"confirm": true
},
{
"name": "Reload",
"description": "Build and launch the debug app tagged to the current branch",
"keywords": ["reload", "build", "run", "launch"],
"command": "./scripts/reload.sh --tag $(git branch --show-current)"
},
{
"name": "Run Unit Tests",
"keywords": ["test", "unit"],
"command": "./scripts/test-unit.sh",
"confirm": true
}
]
}