如何使用tagui自动使用命令行工具和git?

问题描述

如何在我的工作流中使用 git 编写代码来提高 TagUI 的自动化程度?

您对我提供的用于日常使用的示例代码有什么想法可以自动化我的日常编程工作流程吗?

谢谢。 :)

您需要从此处下载 tagui(开源):https://github.com/kelaberetiv/TagUI

解决方法

Windows 机器的示例代码:

// Define path to save data to
savepath = 'C:/tagui/data'

echo Put the windows as you like in the next 5 seconds.
wait 5

// Open command line tool
keyboard [win]r
keyboard cmd[enter]

// Save data to the savepath variable
keyboard cd `savepath`[enter]
keyboard mkdir rezepte[enter]
keyboard cd rezepte[enter]
keyboard git init[enter]
wait 1
keyboard echo I'm writing recipes now. >>log.html[enter]
keyboard echo pizza dough,tomato sauce,cheese >pizza.html[enter]
keyboard echo spaghetti noodles,cumin,garlic powder,celery >spaghetti.html[enter]
keyboard echo tofu,kala namak,olive oil,???,not ready yet,I still have to think about this. >spiegelei.html[enter]
wait 3
keyboard dir[enter]
wait 1
keyboard type pizza.html[enter]
wait 1

// Add finished documents to versioning
keyboard git add pizza.html spaghetti.html[enter]
wait 1

// View documents not yet finished for versioning
keyboard git status[enter]
wait 1

keyboard git commit -m "Added pizza and spaghetti"[enter]
wait 1

// Add all other files in current directory and its subdirectories,which are not yet under version control
keyboard git add .[enter]
wait 1

keyboard git commit -m "Added all untracked files to version control."[enter]
wait 1

// Change pizza recipe to a vegan version
keyboard echo pizza dough,tomatoes,cashew cheeze >pizza.html[enter]
wait 1

// View track of modification
keyboard git status[enter]
wait 1

// Stage changes
keyboard git add .[enter]
wait 1

// Commit changes
keyboard git commit -m "Changed pizza recipe to a vegan version"[enter]
wait 1
// View difference between last 2 commits
keyboard git diff HEAD^ HEAD[enter]

// Add branch only for soups
keyboard git branch soups[enter

// View active branch (expected: master)
keyboard git branch[enter]

// Edit branch
keyboard git checkout soups[enter]

// View active branch (expected: soups)
keyboard git branch[enter]

keyboard echo potatoes,water >potatosoup.html[enter]

// View existing recipe filenames
keyboard dir[enter]

keyboard git commit -m "Added potato soup"[enter]

keyboard git status[enter]
wait 3

// Switch to master branch again
keyboard git checkout master[enter]

// Potato soup is not part of the master branch,everything else is.
// Branches enable parallel work on different feature branches.

// Switch to previous commit
keyboard git checkout ^HEAD[enter]
wait 2

// Go back to all 4 files.
keyboard git checkout soups[enter]

// Go back to master.
keyboard git checkout master[enter]

// Merge soups into master branch.
// (The master itself is an old version of soups,that's why it's easy.)
// After this,master and soups show to identical checkout,// because master was unchanged.
keyboard git merge soups[enter]
wait 2

// The normal scenario is that 2 people are working together,though,in
// 2 different sub-branches,// or for demonstration: both in master branch and salt branch:

// Create and checkout branch salt.
keyboard git checkout -b salt[enter]

// View branches.
keyboard git branch[enter]

// Change pizza recipe to a recipe including salt
keyboard echo "salt,pizza dough,cashew cheeze" > pizza.html[enter]

// Add and commit at once.
keyboard git commit -a -m "Modified pizza,added salt"[enter]
wait 3

// Now change the master,too.
keyboard git checkout master[enter]

// Add another change (oregano) to pizza.html from master branch.
keyboard echo oregano >>pizza.html[enter]

// Save to repository
keyboard git commit -a -m "Use oregano for pizza"

// View status
keyboard git status[enter]

// Two different people from 2 different branches worked
// on the pizza branch. Now,we try to consolidate
// branches into the current master branch.
keyboard git merge salt[enter]

// Merge conflict: The same file was edited from 2 different branches.
echo Please manually resolve conflict by removing merge conflict from pizza.html within next 30 seconds and click back into the cmd window with your mouse.
wait 1
// Open in text editor
keyboard notepad.exe pizza.html[enter]

wait 30
keyboard git add .[enter]

keyboard git status[enter]
keyboard git commit -m "Merged branch salt."[enter]

// Now you can try to go remote with the commands remote,push,fetch,pull,clone.