Documentation ¶
Overview ¶
denvlib provides the mechanics for the denv client. The denv client handles the hidden files in the users home directory which are generally configurations for the users environment.
A simple example use case is when doing Python and Go development on the same box. Python (PEP-8) wants 4 spaces for it's whereas Go likes actual tab characters. Being able to quickly switch between these by activating a denv solves this iise.
Each denv manages a particular environment and can be activated/deactived.
Denv definitions can be pushed/pulled from a remote git server
THIS FILE IS AUTOGENERATED FROM scripts/include.go EDITS WILL BE SQUISHED IT IS MEANT FOR HOLDING CONFIGURABLE OPTIONS
Index ¶
- Constants
- func List() map[*Denv]bool
- func Pull(remote string, branch string) string
- func Push(url, branch, message string) string
- func UserHome() string
- type Config
- type Denv
- func (d *Denv) Enter()
- func (d *Denv) Exit()
- func (d *Denv) Files() (included []string, ignored []string, scripts []string)
- func (d *Denv) IsDenvFile(path string) bool
- func (d *Denv) IsIgnored(path string) bool
- func (d *Denv) IsScript(path string) bool
- func (d *Denv) LoadIgnore()
- func (d *Denv) MatchedFiles(root string) (included []string, ignored []string, scripts []string)
- func (d *Denv) Name() string
- func (d *Denv) SetDenvIgnore(path string)
- func (d *Denv) ToString() string
- type DenvInfo
Constants ¶
const (
Version = "123014f"
)
Variables ¶
This section is empty.
Functions ¶
func List ¶
Gets a map of the denvs currently on the system The returned map is meanted to be used like a set TODO: Make a ls denv -> files
func Pull ¶
Pull the contents of the remote/branch from the remote server onto the local system. If there are conflicts, they will need to be managed manually in ~/.denv This also makes denv scripts executable with chmod 744
Types ¶
type Config ¶
type Config struct { DenvHome string IgnoreFile string InfoFile string RestoreDenv string PreScript string PostScript string }
var Settings Config
type Denv ¶
func Activate ¶
Activate a denv by replacing hidden files in the users home directoty with those in the denv definition. as well as executing the scripts .denvpre in the denv definition If one is not already active, the current state of the users home directory will be stashed and restored whenever the user deactivates. Returns the denv that was activated, nil if there was an error
func Deactivate ¶
func Deactivate() *Denv
Deactivate the current denv and restore it to the state. Also executes the denvs .denvpost scripts. before denv was active. Returns the name of the deactivated denv. Empty string if there was no denv to deactivate
func Snapshot ¶
Creates copies of the hidden files in the users home directory and puts them in a new denv definition in ~/.denv/name. The denv definition can be edited manually after. The default denvignore will be used.
func (*Denv) Enter ¶
func (d *Denv) Enter()
Copy the contents of the denv definition into the users home dir Also execute the PreScripts, before any copy is made
func (*Denv) Files ¶
TODO add denv.AddFile(path) Paths of files in the Denv Definition Tells you which paths are currently included and ignored and which are scripts
func (*Denv) IsDenvFile ¶
Check if this file is able to a be used by this denv
func (*Denv) MatchedFiles ¶
Given an arbitrary path, return which files would be included and which would be ignored. If path contains a folder, it will not be recursed into. Returns the included, ignored and script files
func (*Denv) SetDenvIgnore ¶
Explicitly set this denvs denvignore to the given path