Some arguably useful scripts made or modified by me.
The .NET scripts have their own README in the dotnet
directory.
The perf scripts have their own README in the perf
directory.
A persistent stopwatch.
To start a stopwatch use:
track start <name>
To stop the stopwatch use:
track stop <name>
The total time measured by the stopwatch is returned (in seconds).
To get the current time (amount passed since last start
) use:
track current <name>
To get the total time (amount passed since first start
) use:
track total <name>
To view all stopwatches use (set NO_TABLE
to disable table generation):
track
To delete a stopwatch use:
track end <name>
TRACKER_DIRECTORY
- The path where the files created by this script should get stored at (defaults to$HOME/.local/share/time
).NO_TABLE
- If this variable is set to any non-empty value the script won't generate tables or format text.
Git helper functions.
Outputs the path of the current repository.
Tip
This function also has an alias called find-repo-root
.
source "git-utils.sh"
REPO_PATH=$(find_repo_root)
Check if the current branch is equal to some value, exits if it's not.
source "git-utils.sh"
check_branch <branch>
Checks if the local repo has changes that need to be pushed to the remote repo, exits if there are any changes.
source "git-utils.sh"
check_clean
Syncs $2
with $1
by checking out to $2
and rebasing from $1
, then rebasing $1
from $2
while pushing changes to remote.
source "git-utils.sh"
sync_branches <branch1> <branch2>
Warning
This function does push --force-with-lease
on $1
when rebasing from $2
in the second part of the sync process.
This step is unnecessary and doesn't do anything when $1
is ahead of $2
before the sync.
If there are actual conflicts the sync_branches
command should fail at the first rebase.
Updates the submodules of the current repository.
Tip
This function has a command script called update-submodules
.
source "git-utils.sh"
update_submodules