Skip to content

perryrh0dan/powershell

Repository files navigation

Powershell shortcuts

Powershell profile with useful functions

Description

Adds some shortcuts and usefull commands to the PowerShell

Contents

Install

  1. Clone the repository into your $profile directory without creating a new folder git clone https://github.com/perryrh0dan/powershell .
  2. Update windows execution policy Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
  3. (Optional) Create a variables.ps1 file next to the entrypoint script
  4. Run Install-Module PSReadLine -RequiredVersion 2.3.5 to install PSReadLine
  5. Reload profile with . $profile
  6. (Optional) Create a custom.ps1 file to add custom code next to the entrypoint script

Usage

watch

watch <command>
watch kubectl get pods

find_port

Shows the process that is listening on a given port

find_port <port>

reload

Reloads the path environment variable, so newly installed programs can be used directly

reload

remote_branches

List all remote branches of the current git directory together with the author

dev (volumeOrDirectoy)

Spin up your dev environment as a docker container, either by specifying a directory e.g. dev . to mount the current directory into the development environment or by specifying a docker volume name such as dev avatar, or by entering your REMOTE_DEV_ENV with the dev command without a parameter.

dev_attach <containerId | name>

Connect to a running dev container.

dev_backup

Backup the workspace, history and zoxide directory of the given environment into a local tar archive.

dev_create

Creates a new volume with the specified and sets a label so that it can be easily identified as a development volume.

dev_list

List all volumes with the dev tag.

dev_pull

Pull the latest version of the DOCKER_DEV_ENV.

dev_restore

Create a new dev environment and restore the workspace, history and zoxide directory from a given tar archive.

dev_stop

Stop all running dev containers

dev_tags

List all local available tags of the DOCKER_DEV_ENV.

Parameters

All parameters are persisted in `~/.environments.json' along with the environment name, and are automatically loaded when an environment is started. The values are overridden and overwritten if a parameter is specified. To clear the parameters for an environment, provide the option with a value of 'null'.

parameter descrption example
Port specifiy which port should be exposed to the host system dev . -Port 4200
Tag specifiy a specific tag that should be used from the DOCKER_DEV_ENV default is latest dev . -Tag golang

update

Update this repository with a git pull to keep up with the latest changes.

identities

Options

Following variables can be set in the variables.ps1.

name description example
DOCKER_DEV_ENV docker image to use for the dev environment registry.tpoe.dev/dev
REMOTE_DEV_ENV comma seperated list of 'ssh connection' strings 192.168.0.1,192.168.0.2
SSH_DIRECTORY directory that include ssh keys to be used in the dev container C:/Users/thomas/.ssh
GPG_DIRECTORY directory that include gpg configurations "C:/Users/thomas/.gnupg"
SHARED_DIRECTORY directory that is mounted to easily exchange files between the host system and the development environment "C:/Users/thomas/shared"
KUBE_DIRECTORY directory that include kubectl configuration C:/Users/thomas/.kube
NGROK_DIRECTORY directory that include ngrok configuration C:/Users/thomas/.ngrok
NPM_FILE npmrc file path C:/Users/thomas/.ngrok

Next

  • Find a way to mount the docker credentials from the windows credentials manager into the docker container

Team

License

MIT

This repository was generated by charon

About

Powershell profile with useful functions

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •