gkmngrgn / dosh-core Goto Github PK
View Code? Open in Web Editor NEWShell-independent task manager.
License: MIT License
Shell-independent task manager.
License: MIT License
$ DOSH_ENV="dev" dosh dev
DOSH => [RUN] hugo server -D --bind 0.0.0.0 -b mydomain
^CTraceback (most recent call last):
File "app.py", line 12, in <module>
File "app.py", line 8, in main
File "dosh/cli.py", line 92, in run
File "dosh/config.py", line 70, in run_task
File "lupa/_lupa.pyx", line 587, in lupa._lupa._LuaObject.__call__
File "lupa/_lupa.pyx", line 1333, in lupa._lupa.call_lua
File "lupa/_lupa.pyx", line 1358, in lupa._lupa.execute_lua_call
File "lupa/_lupa.pyx", line 281, in lupa._lupa.LuaRuntime.reraise_on_exception
File "lupa/_lupa.pyx", line 1496, in lupa._lupa.py_call_with_gil
File "lupa/_lupa.pyx", line 1483, in lupa._lupa.call_python
File "dosh/commands/external.py", line 112, in run
KeyboardInterrupt
[64905] Failed to execute script 'app' due to unhandled exception!
I've a command to sync my changes in my website with the server:
cmd.run("rsync -avz --delete public/ user@domain:/var/www/html/domain/")
But this command doesn't work if you don't have rsync. So, we need a native Python function to sync folders.
Sometimes I want to run a separate dosh config from another one. This can be in my file path or in a public url.
cmd.run_dosh(
"https://raw.githubusercontent.com/gkmngrgn/emacs.d/main/dosh.lua",
{task = "install", parameters = "--noconfirm"}
)
Additionally it may be a good idea to rename run_url
command with run_bash
or something else.
Currently, it's just saying that the required config file doesn't exist.
for repo in $(curl -X GET "https://gitea.server/api/v1/repos/search?uid=goedev&limit=10000" \
-H "accept: application/json" \
-H "Authorization: token very-very-secret-token" \
-H "Content-Type: application/json" \
-s | jq -c ".data[] | {ssh_url,name}"); do
ssh_url=$(echo $repo | jq -r ".ssh_url")
name=$(echo $repo | jq -r ".name")
repo_dir="$HOME/Workspace/goedev/$name"
if [ -d $repo_dir ]; then
echo "Repo $name is syncing..."
git -C $repo_dir pull
else
echo "Repo $name is cloning..."
git clone $ssh_url $repo_dir
fi
echo ""
done
As in --config
parameter, I want to change the current working directory using --directory
parameter. It will be very helpful to run tests without installing dosh
.
$ dosh deploy
DOSH => [RUN] hugo
DOSH => [RUN] rsync -avz --delete public/ [email protected]:/var/www/html/gokmengorgen.net/
Traceback (most recent call last):
File "app.py", line 12, in <module>
File "app.py", line 8, in main
File "dosh/cli.py", line 92, in run
File "dosh/config.py", line 70, in run_task
File "lupa/_lupa.pyx", line 587, in lupa._lupa._LuaObject.__call__
File "lupa/_lupa.pyx", line 1333, in lupa._lupa.call_lua
File "lupa/_lupa.pyx", line 1358, in lupa._lupa.execute_lua_call
File "lupa/_lupa.pyx", line 281, in lupa._lupa.LuaRuntime.reraise_on_exception
File "lupa/_lupa.pyx", line 1496, in lupa._lupa.py_call_with_gil
File "lupa/_lupa.pyx", line 1483, in lupa._lupa.call_python
File "dosh/commands/external.py", line 116, in run
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc5 in position 11: invalid continuation byte
[64981] Failed to execute script 'app' due to unhandled exception!
There should be a function to run the other tasks.
My planned help output is like this one:
$ dosh help
dosh 0.1.0
shell-independent command manager
Tasks:
> setup_my_os place my config files.
> install_cli_apps install my favorite apps.
> sync_repos do not forget to push your changes before working on a different
laptop.
- repo_path: str, optional
If you are new to dosh, consider running `dosh --help` to learn using dosh.
This help output has three parts:
--help
parameter.I want to allow the clients to edit the first and the last parts.
Add a new subtitle to explain the differences between dosh and the other apps like cmake, makefile, etc.
I want to know if a task accepts an option. In the help output, I should see all available options with the type, choices, and the default value.
dosh - shell-independent task manager
Tasks:
> setup SETUP_TYPE setup my operating system.
setup_type: all, emacs, python, shell, tmux (default: all)
Dosh commands:
> help print this output
> init initialize a new config in current working directory
-c, --config PATH specify config path (default: dosh.lua)
-d, --directory PATH change the working directory
-v|vv|vvv, --verbose increase the verbosity of messages:
1 - default, 2 - detailed, 3 - debug
An idea for config:
cmd.add_task {
name = "setup",
description = "setup my operating system.",
required_platforms = {"macos"},
command_options = {
setup_type = {
type = "string",
options = {"all", "emacs", "python", "shell", "tmux"},
default = "all"
}
},
command = function(options)
print(options)
end
}
to change the current working directory.
Instead of using print
, we support four levels of logging:
debug
info
warning
error
Currently, dosh doesn't show any output. The default level should be info
.
Sample use here:
local config_dirs = cmd.ls{
parent_dir = ".",
exclude = { "home", "archived" },
file_types = { "directory" },
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.