1 Star 0 Fork 0

oshine / om

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
om.woo 3.54 KB
Copy Edit Raw Blame History
oshine authored 2022-04-28 22:17 . 努力更新奔小康
#!env woo
-- Author: liyanxi
-- Email: liyanxi_rhett@outlook.com
-- when install this plugs ,the init.woo will be run one times.
--https://gitee.com/oshine/om/raw/master/init.woo
--curl https://gitee.com/oshine/om/raw/master/init.woo -s
--print('dir:==', dir(''))
--print(_DIR)
--print('pwd:==', pwd())
require(_cat('/Users/fsk/om/bin-path/rename', 1) .. 'om')
local table = table
local require = require
local ver = '1.?'
install_dir = _env('OM_PATH') or (_home() .. '/om')
package.path = install_dir .. '/?.woo;' .. package.path .. ';'
local conf = require('oshine.om@' .. ver .. ':conf.conf')
local trs = require('oshine.om@' .. ver .. ':conf.trs')
local lan = conf.language
print("package.path:===", package.path)
local args1 = _args()
table.remove(args1, 1)
if _os() == 'windows' then
if args1[1] == 'om' then
table.remove(args1, 1)
end
else
-- handler for cmdline [om cmd oshine/rename rename]
-- rename -i= woo OM_PATH/om.woo cmd oshine/rename -i
-- rename 导出的记录记录在 ~/om/bin-path/rename
-- 内容:
-- oshine@1.?
if #args1 > 2 then
local r = require(args1[2] .. '.cmd.' .. args1[3])
local p = {}
if #args1 > 3 then
local index = 1
for i, v in pairs(args1) do
if index > 3 then
p[i] = v
end
index = index + 1
end
end
r.run(p)
end
return
end
print('om get real args:===', _json_encode(args1))
--if _in_array(args1[1], { 'install', 'i' }) then
-- require('oshine.om@1.?:installer'):new(args1[2] or _pwd()):install()
-- return
--end
local any_type = require('oshine.woo_any_type@anyType'):new(args1)
local capture = require('oshine.woo_args@capture', ':'):new(any_type:sliceToRight(1))
capture:withDoc('oshine.om@1.?:doc/om')
any_type = nil
capture :catch('check', function()
-- check all installed plug's status/检查所有的已经安装的plugs的运行状态
end, true):catch('update i', function(c)
-- 仅仅搜索om包
end, true):catch('search', function(c)
-- 仅仅搜索om包
end, true):catch('ls', function(c)
-- 仅仅列出本地om包
end, true):catch('rm', function(c)
-- 仅仅删除本地om包
end, true):catch('config', function(package_c, is_show_help)
local key = package_c:catchNext()
local val = package_c:catchNext()
local dir = require('oshine/om', 'dir', ver)
if key and val then
local config = require('oshine/conf', 'conf', ver):new(dir .. '/conf/conf.woo'):set(key, val):save()
-- 查看conf保存结果是否有错误
if not config:err() then
conf = config:conf()
end
elseif is_show_help then
else
local v = require('oshine.om', 'utils.utils', ver).get(key)
end
end, true):catch('status', function(c)
--c:trgger('pakcage.status')
end, true):catch('test', function()
-- om test oshine/bitmap [main] // show all demo about oshine/bitmap
-- om test oshine/bitmap circle // run circle demo
-- om test oshine/bitmap list: // run circle demo
end, true):match(function(c)
-- if cache not matched,use match function to match again.
local l = require('oshine/om', 'plugs_list', ver)
local key = c:catchNext()
for k, v in pairs(l) do
if k == key then
require(v).run(c)
break
else
local arr = _str_split(k, ' ')
if _in_array(key, arr) then
require(v).run(c)
break
end
end
end
end, true):run(true)
1
https://gitee.com/oshine/om.git
git@gitee.com:oshine/om.git
oshine
om
om
master

Search