Borrowed time is my personal project management application. As a security consultant, I switched projects every week or two. This tool helps automate some tasks such as project structure creation.
It's named after a discipline priest spell in World of Warcraft:
Note: Borrowed Time is under heavy development. The API of sub-packages and
prompter
might be modified.
Borrowed Time is mainly developed and used on Windows. Currently, only Windows is supported. However, no OS dependent libraries are in use so default editors/locations/paths can be added for other Operating Systems.
go get github.com/parsiya/borrowedtime
.go run main.go
or go build
to build the program.Borrowed Time directly uses the following packages:
Execute Borrowed Time and run the Deploy
command. Press Tab
to see options
at any time. It creates a directory named borrowedtime
in your home directory
and opens the configuration file in the default editor in your OS. Home is based
on go-homedir. Home on Windows is
C:\Users\[your-user]\
.
borrowedtime
│ config.json
│
├───backups
├───data
└───templates
├───file
│ creds.md
│ findings-submitted.md
│ git-config.toml
│ notes.md
│ project-config.json
│ readme.md
│ scratch-pad.md
│ todo-done.md
│ todo.md
│
└───project
issue-5.json
project-structure.json
project2.json
Borrowed Time uses a configuration file to persist settings. It's a plaintext JSON file. New entries can be added manually. These can be used in file/project templates. A sample configuration file on Windows:
{
"burppath": "",
"editor": "C:/Program Files/Microsoft VS Code/Code.exe",
"projectstructure": "project-structure",
"workspace": "C:/Users/Parsia/Desktop/projects",
"yourname": ""
}
Borrowed Time has a few different commands.
deploy
installs Borrowed Time (creates the config file and the directory
structure) and opens the configuration file with the default editor
(notepad on Windows). The config file is pre-populated with some values
(e.g. VSCode as editor on Windows). Modify the config file to point to your
editor and your desired project root directory.
The project root directory is where all project directories are created.
The config
subcommand is used to manipulate the configuration. For example,
config edit
opens the configuration file in the editor set in the config file.
backup
stores the config file and data/templates
directories in a zip
file under backup. The default name is based on the system's timestamp but
it can be modified. You cannot overwrite backup files.restore
silently creates a backup and then overwrites the config file,
and data/templates
directories.edit
opens the configuration directory. This can be used to edit the
configuration file or data/templates.project
command creates and edits projects created inside the workspace
set in the config file. Each project is a separate directory. Borrowed Time
supports automatically creating projects and files inside them using a JSON
template file. See Project Templates
below.
list
prints a list of all top-level directories inside workspace
.
create
creates a new project inside the workspace
with an optional file
containing the project structure and overwrite (false by default). Then opens
the project. First value after create
is the project name.
Examples:
project create test1
- Create a new project named test1
.project create test1 -template template1
- Create a new project named test1
using template1.json
.project create test1 -template template1 -overwrite
- Create a new project named test1
using template1.json
and overwrite any existing projects.Note: overwrite
does not delete the previous project directory. Existing files
that are not in the new template are not touched. Only files that are in both
templates are overwritten.
Note about project names with spaces:
project create "project name with spaces"
project create "test1"
.open
opens a project with the editor (if the editor supports opening
directories). The path to the project is passed to the editor as an argument.
Borrowed Time can customize project structure and generated files with
templates. To edit templates use the config edit
command to open the config
directory in the default editor.
Project templates are JSON files in the following structure. They use the Go template engine.
Workspace
points to the root of your workspace.ProjectName
is the name of the directory.Project templates should be stored under the templates/project
directory.
Note the children's path is relative to their parent. The tool is not looking for full paths for children.
{
"path": "{{ .Workspace }}/{{ .ProjectName }}",
"info": {
"isdir": true,
"template": ""
},
"children": [
{
"path": ".config.json",
"info": {
"isdir": false,
"template": "project-config"
},
"children": []
},
{
"path": "@notes.md",
"info": {
"isdir": false,
"template": "notes"
},
"children": []
},
{
"path": "@pix",
"info": {
"isdir": true,
"template": ""
},
"children": []
},
]
}
As you can see, each file can have its own individual template (see below for
file templates). The value of template
is ignored for directories.
File templates are text files. They can contain similar placeholders based on
the template engine. For example, the notes
template is:
# {{ .ProjectName }} Notes
##
File templates should be stored under the templates/file
directory.
File templates can be modified directly. Add new directories, files, and assign
file templates at you see fit. New templates can be added manually by dropping
them into the templates
directory or more conveniently using the config edit
command that opens the config directory in the editor.
You can use sub-directories to manage templates but each template name must be
unique deployment wide. This means you cannot have two files named notes.md
inside the templates
directory in different sub-directories. Extensions are
also ignored meaning you cannot have both notes.md
and notes.json
.
If you have duplicate template names, it will cause undefined behavior.
The template is addressed by the name of the file containing it without the extension. You can choose any extension.
It's possible to add custom items to the configuration file and use them in the
file templates without rebuilding the application. The project struct has a
field named Config
that is populated with a map of key/values from the
configuration file.
"customkey": "value"
.{{ index .Config "customkey" }}
.
Keys are case-sensitive. Use only use lowercase keys for simplicity.customkey
from the
configuration file.Personally, I am very proud of how this part turned out.
Data files are located in the data
directory and are free-format. They can be
used to incorporate data into your templates. To edit the data files, run
config edit
to open the configuration directory in your editor.There used to
be a data
command but it has been removed.
Opensourced under the Apache License v 2.0 license. See LICENSE for details.
Now in Github issues.
edit
command to template and data files.prompter
is released.dep
support.