Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Config(type, filename) open yaml file to Config #226

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shewer
Copy link
Contributor

@shewer shewer commented Jan 30, 2023

增加 Config() 開啓 、更新、新增、儲存 yaml
可在載入 rime.lua 時期(deplop , start engine 前),編輯yaml

-- Config(type, filename)
-- type : [config|user_config|schema|config_builder] -- filename: [userdir|sharedir]/[build/]filename.[schema].yaml

  • type:'config' [user_dir|shared]/build/[filename].yaml -- 載入已佈署完 yaml
  • type:'user_config' [user_dir|shared]/[filename].yaml -- 載入未佈署的 yaml
  • type:'schema' [user_dir|shared]/build/[filename].schema.yaml -- 載入已佈署完 yaml
  • type:'config_builder' [user_dir|shared]/build/[filename].yaml and patch custom.yaml --載入 yaml & custom.yaml
function M:test_init()
  local c1=Config('user_config','cangjie5.schema') --[shard_dir|user_dir]/cangjie5.yaml
  local c2=Config('user_config','cangjie5.custom') --[shard_dir|user_dir]/cangjie5.yaml
  local c3=Config('config','cangjie5.schema') -- [shard_dir|user_dir]/build/cangjie5.yaml
  local c4=Config('schema','cangjie5') --[shard_dir|user_dir]/build/cangjie5.schema.yaml
  local c5=Config('config_builder','cangjie5.schema') -- [shard_dir|user_dir]/build/cangji
««tch form custom.yaml
  lu.assertIsUserdata(c1)
  lu.assertIsUserdata(c2)
  lu.assertIsUserdata(c3)
  lu.assertIsUserdata(c4)
  lu.assertIsUserdata(c5)

-- Config(type, filename)  
-- type : [config|user_config|schema|config_builder]
-- filename: [userdir|sharedir]/[build/]filename.[schema].yaml

--    type:'config'  [user_dir|shared]/build/[filename].yaml
--    type:'user_config'  [user_dir|shared]/[filename].yaml
--    type:'schema'  [user_dir|shared]/build/[filename].schema.yaml
--    type:'config_builder'  [user_dir|shared]/build/[filename].yaml and patch custom.yaml
--
function M:test_init()
  local c1=Config('user_config','cangjie5.schema') --[shard_dir|user_dir]/cangjie5.yaml
  local c2=Config('user_config','cangjie5.custom') --[shard_dir|user_dir]/cangjie5.yaml
  local c3=Config('config','cangjie5.schema') -- [shard_dir|user_dir]/build/cangjie5.yaml
  local c4=Config('schema','cangjie5') --[shard_dir|user_dir]/build/cangjie5.schema.yaml
  local c5=Config('config_builder','cangjie5.schema') -- [shard_dir|user_dir]/build/cangji
««tch form custom.yaml
  lu.assertIsUserdata(c1)
  lu.assertIsUserdata(c2)
  lu.assertIsUserdata(c3)
  lu.assertIsUserdata(c4)
  lu.assertIsUserdata(c5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant