feat: v0.1.0 #1

Merged
dmitry merged 12 commits from dev into main 2025-12-27 12:05:30 +03:00
Showing only changes of commit 43882ede49 - Show all commits

View File

@@ -26,6 +26,23 @@ managed_path = "~/.config"
# default is "~/.config/userctx" # default is "~/.config/userctx"
contexts_path = "~/.config/userctx" contexts_path = "~/.config/userctx"
[apps]
helix.symlink."*" = "themes/theme.toml"
helix.code = "pkill -USR1 hx"
example2.scripts = ["s1", "s2"]
[apps.example]
symlink."this.file" = "that.file"
code = 'echo "this simulates reload command"'
[apps.niri]
code = "this simulates code for niri restart"
[apps.niri.symlink]
"another.file" = "another.link"
# This section of config is intended to document # This section of config is intended to document
# what userctx can do. Assume we are # what userctx can do. Assume we are
# building a config for app "example" # building a config for app "example"
@@ -38,6 +55,7 @@ contexts_path = "~/.config/userctx"
# "source_path". Then userctx will try to lookup # "source_path". Then userctx will try to lookup
# app settings in /source_path/<context_name> # app settings in /source_path/<context_name>
source_path = "~/some/path" source_path = "~/some/path"
# The default path to apply your context to is # The default path to apply your context to is
# ~/.config/example (for app name "example") # ~/.config/example (for app name "example")
# or if you provided a "managed path" in "general" section above, # or if you provided a "managed path" in "general" section above,
@@ -48,44 +66,31 @@ source_path = "~/some/path"
# path. # path.
target_path = "~/.config/example/configs" target_path = "~/.config/example/configs"
# "actions" array defines which steps should be # "symlink" map defines
# executed to apply content from
# context directory to users home
# directory. If actions array is empty the default
# behaviour is to just symlink everything from
# $CONTEXT_SRC to $CONTEXT_DST
actions = [
"symlinks", # do the symlinking as specified in "symlinks"
"exec", # execute shell script from object "code" below
"commands", # run commands from "commands array below"
"scripts", # run scripts from "scripts" array below
]
# "symlinks" array of mappings (inline tables of TOML) defines
# which files will be symlinked to users home # which files will be symlinked to users home
# directory. If "symlinks" key is present in # directory. If "symlinks" key is present in
# "actions" above but this "symlinks" array is omitted # "actions" above but this "symlinks" array is omitted
# then userctx treats all files in the context directory as # then userctx treats all files in the context directory as
# files that must be symlinked to users home. # files that must be symlinked to users home.
symlinks = [ # Names of files in these mapping are relative to
# names of files in these mapping are relative to # context directory and target directory
# context directory and target directory # by default source is ~/.config/userctx/<context_name>/example for
# by default source is ~/.config/userctx/<context_name>/example for # task (app) named "example"
# task (app) named "example" # default target directory is ~/.config/example for
# default target directory is ~/.config/example for # task (app) named "example"
# task (app) named "example" #
# # this will link file from context dir to destination dir
# this will link file from context dir to destination dir # $CONTEXT_SRC/context_file.conf -> $CONTEXT_DST/symlink_to_context_file.conf
# $CONTEXT_SRC/context_file.conf -> $CONTEXT_DST/symlink_to_context_file.conf symlink."context_file.conf" = "symlink_to_context_file.conf"
{"context_file.conf" = "symlink_to_context_file.conf"},
# this will link file to subdirectory inside destination dir
# this will link file to subdirectory inside destination dir # directory must be created beforehand
# directory must be created beforehand # $CONTEXT_SRC/other_file.conf -> $CONTEXT_DST/subdir/other_file.conf
# $CONTEXT_SRC/other_file.conf -> $CONTEXT_DST/subdir/other_file.conf
{"other_file.conf" = "subdir/other_file.conf" }, symlink."other_file.conf" = "subdir/other_file.conf"
# also possible option # also possible option
{"subdir/yet_another_file.conf" = "yet_another_file.conf" }, symlink."subdir/yet_another_file.conf" = "yet_another_file.conf"
]
# "code" object let's you write # "code" object let's you write
# a custom script that will apply contents of # a custom script that will apply contents of