Package: yuritasks
YuriA task automation tool written in python. Yuri it's an API that lets you automate those boring and repetitive commands.InstallationInstall yuri with pip:pipinstallyuriInstalling from source:gitclone<repo_url>cdyuri
pipinstallsetuptools
pipinstall.Usage/Examples# task_automation.pyimportyuritasksasyuriyuri.do.var('source_dir','C:\\foo\bar\baz')@yuri.taskdefmyproject_commit_source(_args):"""Commit changes in my project"""yuri.do.cd('$source_dir')\.run('git add -A')\.run_with_input('git commit -m "{i}"','Your changes: ')\.run('git pull')\.run('git push -u origin develop')@yuri.taskdefmyproject_clean_up_source(_args):"""Clean up pyc files from source"""yuri.do.cd('$source_dir')pyc_files=yuri.do.filter(yuri.do.files_list(),['.pyc'])yuri.do.delete(pyc_files)if__name__=='__main__':yuri.run()Then run on terminal:pythontask_automation.pySo you will be hable to see yuri's namespace menu first:So choose the namespace to work on, 0 in this case, and you will se the available tasks:Now just enter the task id of the task you want to run!Tasks name conventionsYou should name yours tasks as follows:importyuritasksasyuri@yuri.taskdefYOURNAMESPACE_task_name(_args):"""Your task help here"""pass@yuri.taskdefYOURNAMESPACE_second_task_name(_args):"""Your task help here"""pass@yuri.taskdefOTHERNAMESPACE_task_name(_args):"""Your task help here"""passif__name__=='__main__':yuri.run()As you may noticed, tasks' functions must be named withnamespacethen_undersocore and finally the task name. A namespace is a way to organize different tasks in common sections.Task argumentsYou can pass arguments to your tasks via cli, just as follows:importyuritasksasyuri@yuri.taskdeffoo_bar_task(args):print(args)if__name__=='__main__':yuri.run()When you runs bar_task put your arguments before task id:Extra configsYou can make a shortcut to quick run your tasks automations:API Referenceyuri.do <yuki.Tasker object>This object contains the command excecution methods.yuri.do.pause() -> TaskerTasker waits until enter key is pressed.yuri.do.waifu_print(message: str) -> TaskerPrints an string using the waifu banner.ArgsstringString to display.yuri.do.log_print(message: str) -> TaskerPrints an string but also displays the current working folder.ArgsstringString to display.yuri.do.ignore_errors() -> TaskerTasker will keep excecuting the following tasks even prev tasks could fail.yuri.do.var(name: str, val: Any=None) -> AnyStores a var that could be used like $var_name in the tasker method arguments strings.By example, if you setyuri.do.var('foo_dir', 'c:\\bar')then you can doyuri.do.cd('$foo_dir').ArgsnameThe var name.valThe value of the var.yuri.do.clear() -> TaskerClears the console.yuri.do.dirs_list() -> listReturns the directories lists of the current working dir.yuri.do.files_list() -> listReturns the files lists of the current working dir.yuri.do.terminate() -> NoneTerminates the running task.yuri.do.cd(dir: str) -> TaskerChanges the current working dir.ArgsdirDirectory to move on.yuri.do.navto(url: str) -> TaskerOpens the url in a webbrowser.ArgsurlUrl to open.yuri.do.run(cmd: str) -> TaskerExcecutes a system command.ArgscmdCommand to execute.yuri.do.get_input(msg: str, default: str=None, can_be_null: bool=False) -> strRead keyboard input with an optional default value.ArgsmsgText to display when input request.defaultDefault value used if user do not type anything.can_be_nullIf true, input can be empty.yuri.do.run_with_input(cmd: str, msg: str) -> TaskerRuns a command but request an keyboard input and{i}string in the command line is replaced by the input result before excecute the command.By example.yuri.do.run_with_input("cd {i}", "Type a directory: ")will runcd the_typed_directory.ArgscmdComand to run. it must contain '{i}' string to be replaced with  the input result.msgMessage showed to request the input.yuri.do.copy(elements: list, destiny: str) -> TaskerCopies files or directories to the destiny directory. If
the element that is beeing copied it's a directory its content
will be copied recursively.ArgselementsIt could be a list of files, directories or both.destinyPath where elements will be copied.yuri.do.delete(elements: list) -> TaskerDeletes files or directories.ArgselementsA list of files, directories or both to delete.yuri.do.filter(elements: list, filters: list) -> listRemoves the elements from a list that does not contains any of the string in the filters list.By example.yuri.do.filter(["foo.png", "bar.jpg", "baz.mp3"], [" png", ".jpg"])will return["foo.png", "bar.png"].ArgselementsList of elements that will be filtered.filtersList of strings that elements must contain.yuri.do.subprocess(cmd: str)  -> TaskerRuns a command in a new console using a secondary thread. This means that command excecuted by this way will not interrupt tasks execution even if that command havent finished yet.Authors@edo0xffLicenseMITCHANGELOGVersion 0.0.1 25/09/2022First release