# Cli R&D ## [Choco/Chocolatey](https://chocolatey.org/) Chocolatey is a software management solution unlike anything else you've ever experienced on Windows. Chocolatey brings the concepts of true package management to allow you to version things, manage dependencies and installation order, better inventory management, and other features. - Install Package `choco install pkgname`, adding `-y` will confirm all the prompts : `choco install pkgname -y` - Checking all commands and flags available : `choco --help` ### Available Commands * list - lists remote or local packages * find - searches remote or local packages (alias for search) * search - searches remote or local packages (alias for list) * info - retrieves package information. Shorthand for choco search pkgname --exact --verbose * install - installs packages from various sources * pin - suppress upgrades for a package * outdated - retrieves packages that are outdated. Similar to upgrade all --noop * upgrade - upgrades packages from various sources * uninstall - uninstalls a package * pack - packages up a nuspec to a compiled nupkg * push - pushes a compiled nupkg * new - generates files necessary for a chocolatey package from a template * sources - view and configure default sources (alias for source) * source - view and configure default sources * config - Retrieve and configure config file settings * feature - view and configure choco features * features - view and configure choco features (alias for feature) * setapikey - retrieves, saves or deletes an apikey for a particular source (alias for apikey) * apikey - retrieves, saves or deletes an apikey for a particular source * unpackself - have chocolatey set itself up * version - [DEPRECATED] will be removed in v1 - use `choco outdated` or `cup <pkg|all> -whatif` instead * update - [DEPRECATED] RESERVED for future use (you are looking for upgrade, these are not the droids you are looking for) ### Flags ```shell= -?, --help, -h Prints out the help menu. -d, --debug Debug - Show debug messaging. -v, --verbose Verbose - Show verbose messaging. Very verbose messaging, avoid using under normal circumstances. --trace Trace - Show trace messaging. Very, very verbose trace messaging. Avoid except when needing super low-level .NET Framework debugging. Available in 0.10.4+. --nocolor, --no-color No Color - Do not show colorization in logging output. This overrides the feature 'logWithoutColor', set to 'False'. Available in 0.10.9+. --acceptlicense, --accept-license AcceptLicense - Accept license dialogs automatically. Reserved for future use. -y, --yes, --confirm Confirm all prompts - Chooses affirmative answer instead of prompting. Implies --accept-license -f, --force Force - force the behavior. Do not use force during normal operation - it subverts some of the smart behavior for commands. --noop, --whatif, --what-if NoOp / WhatIf - Don't actually do anything. -r, --limitoutput, --limit-output LimitOutput - Limit the output to essential information --timeout, --execution-timeout=VALUE CommandExecutionTimeout (in seconds) - The time to allow a command to finish before timing out. Overrides the default execution timeout in the configuration of 2700 seconds. '0' for infinite starting in 0.10.4. -c, --cache, --cachelocation, --cache-location=VALUE CacheLocation - Location for download cache, defaults to %TEMP% or value in chocolatey.config file. --allowunofficial, --allow-unofficial, --allowunofficialbuild, --allow-unofficial-build AllowUnofficialBuild - When not using the official build you must set this flag for choco to continue. --failstderr, --failonstderr, --fail-on-stderr, --fail-on-standard-error, --fail-on-error-output FailOnStandardError - Fail on standard error output (stderr), typically received when running external commands during install providers. This overrides the feature failOnStandardError. --use-system-powershell UseSystemPowerShell - Execute PowerShell using an external process instead of the built-in PowerShell host. Should only be used when internal host is failing. Available in 0.9.10+. --no-progress Do Not Show Progress - Do not show download progress percentages. Available in 0.10.4+. --proxy=VALUE Proxy Location - Explicit proxy location. Overrides the default proxy location of ''. Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+. --proxy-user=VALUE Proxy User Name - Explicit proxy user (optional). Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy user of ''. Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+. --proxy-password=VALUE Proxy Password - Explicit proxy password (optional) to be used with username. Requires explicity proxy (`--proxy` or config setting) and user name. Overrides the default proxy password (encrypted in settings if set). Available for config settings in 0.9.9.9+, this CLI option available in 0.10.4+. --proxy-bypass-list=VALUE ProxyBypassList - Comma separated list of regex locations to bypass on proxy. Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy bypass list of ''. Available in 0.10.4+. --proxy-bypass-on-local Proxy Bypass On Local - Bypass proxy for local connections. Requires explicity proxy (`--proxy` or config setting). Overrides the default proxy bypass on local setting of 'True'. Available in 0.10.4+. --log-file=VALUE Log File to output to in addition to regular loggers. Available in 0.1- 0.8+. ``` ### Experiments - Running : `choco info zip` ```shell= Title: Info-ZIP | Published: 22-Jul-15 Package approved by ferventcoder on Dec 28 2015 16:44:48. Package testing status: Passing on Dec 20 2015 11:36:25. Number of Downloads: 274936 | Downloads for this version: 274936 Package url Chocolatey Package Source: n/a Package Checksum: 'BoA6DFar2Pc3q618yD3W5lhrwh0t5nercxIcR0UtVK6XrqhY+qLIwzFn2i9HP2b9BLEWDGJ/YvLjuvxoOOfF0w==' (SHA512) Tags: compression zip archive Software Site: http://www.info-zip.org/ Software License: http://www.info-zip.org/license.html Summary: package and compress (archive) files Description: Info-ZIP's purpose is to provide free, portable, high-quality versions of the Zip and UnZip compressor-archiver utilities that are compatible with the DOS-based PKZIP by PKWARE, Inc. ``` - Running : `choco list zip` ```shell= zip 3.0 [Approved] Downloads cached for licensed users zip.template 1.0.0 [Approved] unzip 6.0 [Approved] Downloads cached for licensed users 7zip 19.0 [Approved] 7zip.portable 19.0 [Approved] 7zip.commandline 16.02.0.20170209 [Approved] 7zip.install 19.0 [Approved] Devbox-UnZip 5.52 - Possibly broken peazip 8.3.0 [Approved] lhaplus 1.59.3 - Possibly broken peazip.portable 6.0.3 [Approved] Downloads cached for licensed users peazip.install 8.3.0 [Approved] kzip 0.0.20070414 - Possibly broken archive 0.0.7 [Approved] zipinst 1.21 [Approved] Downloads cached for licensed users VirtualEngine-Compression 1.1.0.18 [Approved] Downloads cached for licensed users bandizip 7.21 [Approved] Downloads cached for licensed users DeflOpt 2.0.7 - Possibly broken freearc 0.666 [Approved] freearc.install 0.666 [Approved] Downloads cached for licensed users - Possibly broken for FOSS users (due to original download location changes by vendor) freearc.portable 0.666 [Approved] Downloads cached for licensed users universal-extractor 1.6.1.20161126 [Approved] Downloads cached for licensed users Fitbit.Connect 2.0.0.6512 [Approved] - Possibly broken archiver 3.1.0 [Approved] Downloads cached for licensed users Easy7zip 0.1.6 [Approved] Downloads cached for licensed users winmerge-7z 0028.465.920 [Approved] - Possibly broken passcovery 3.1 [Approved] Downloads cached for licensed users yacreader 9.8.2 [Approved] carbon 2.10.2 [Approved] lzip7z 1.6 [Approved] bzip2 1.0.5 [Approved] lzip 1.19 [Approved] gzip 1.3.12 [Approved] 7zip-zstd 1.4.9.20 [Approved] jwpce 1.50.20200915 [Approved] Downloads cached for licensed users lhaca 0.76 [Approved] - Possibly broken keepass-classic-langfiles 1.31 [Approved] syncback 7.6.36.0 [Approved] - Possibly broken keepass-langfiles 2.41 [Approved] wpilib 2021.3.1 [Approved] shexview.install 2.01 [Approved] Downloads cached for licensed users shexview.portable 2.01 [Approved] Downloads cached for licensed users intel-proset-drivers 22.60.0 [Approved] git-lfx 0.1.0 [Approved] shexview 2.01 [Approved] xmplay 3.8.5 [Approved] MSFilterPack2-redist-x64 1.1 [Approved] PsGet 1.0.4.407 [Approved] ripgrep 13.0.0.20210621 [Approved] modern7z 1.8.7.2 [Approved] ArecaBackup 7.5 [Approved] Downloads cached for licensed users winrar 6.02 [Approved] Downloads cached for licensed users hazelcast 3.5 [Approved] Downloads cached for licensed users sync 2.20 [Approved] Downloads cached for licensed users HtmlPackager 0.1.9 [Approved] capture2text 4.6.1 [Approved] Downloads cached for licensed users transwiz-new 1.17 [Approved] Downloads cached for licensed users flac 1.3.2 [Approved] Downloads cached for licensed users wavpack7z 1.3 [Approved] libressl 2.5.5 [Approved] weather-chrome 4.2.97 [Approved] uniextract.portable 1.6.1 [Approved] Downloads cached for licensed users getdiz 4.91 [Approved] batch-file-encrypt 5.0.0 [Approved] Downloads cached for licensed users batch-files 5.0.0 [Approved] Downloads cached for licensed users file-hash-generator 5.0.0 [Approved] Downloads cached for licensed users freecommander 2009.2.2 uniextract 1.6.1 [Approved] uniextract.install 1.6.1 [Approved] Downloads cached for licensed users 0install 2.20.0 [Approved] nexus-root-toolkit 2.1.9.20170607 [Approved] golly 4.0 [Approved] wimlib 1.13.4 [Approved] Downloads cached for licensed users batch-hex-editor 5.0.0 [Approved] Downloads cached for licensed users batch-text-file-editor 5.0.0 [Approved] Downloads cached for licensed users PersonalBackup 6.2.0701 [Approved] Downloads cached for licensed users nmm 0.83.3 [Approved] leanify 0.4.2 [Approved] Downloads cached for licensed users kindle-comic-converter 5.5.2.20210830 [Approved] allow-block-remove-firewall 1.0.0 [Approved] Downloads cached for licensed users batch-regex 5.0.0 [Approved] Downloads cached for licensed users sleeponlan 1.1 [Approved] Downloads cached for licensed users CLOC 1.90 [Approved] vim 8.2.3595 [Approved] komodo-ide 12.0.1 [Approved] Downloads cached for licensed users choco-cleaner 0.0.8.4 [Approved] internet-download-manager 6.39.8 [Approved] Downloads cached for licensed users bgb 1.5.9 [Approved] Downloads cached for licensed users disk-wipe 1.7 [Approved] Downloads cached for licensed users stigviewer 2.15 [Approved] Downloads cached for licensed users 90 packages found. ``` ### Recipes - Uses powershell - Structure ```shell= $packageName= 'bob' $toolsDir = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" $url = 'https://somewhere.com/file.msi' $url64 = 'https://somewhere.com/file-x64.msi' $packageArgs = @{ packageName = $packageName fileType = 'msi' url = $url url64bit = $url64 silentArgs = "/qn /norestart" validExitCodes= @(0, 3010, 1641) softwareName = 'Bob*' checksum = '12345' checksumType = 'sha256' checksum64 = '123356' checksumType64= 'sha256' } Install-ChocolateyPackage @packageArgs ``` ### Examples - flashplayerplugin ![](https://i.imgur.com/vNqdVRT.png) - chrome ![](https://i.imgur.com/3AvlTmb.png) ### Supports - Windows ## [Snap](https://snapcraft.io/) Snaps are app packages for desktop, cloud and IoT that are easy to install, secure, cross‐platform and dependency‐free. Snaps are discoverable and installable from the Snap Store, the app store for Linux with an audience of millions. - Install Package `snap install pkgname` - Checking all commands and flags `man snap` ## Segments of snap - Snap: Used to refer to both the application package format and the command-line interface. - Snapd: A Snap daemon that helps in managing and maintaining snaps. - Snap Store: Home to all snaps; allows you to upload your own snaps and explore and install new snaps. - Snapcraft: A framework that helps you build your own snaps. ### Basic Commands ```shell= Commonly used commands can be classified as follows: Basics: find, info, install, remove, list ...more: refresh, revert, switch, disable, enable, create-cohort History: changes, tasks, abort, watch Daemons: services, start, stop, restart, logs Permissions: connections, interface, connect, disconnect Configuration: get, set, unset, wait App Aliases: alias, aliases, unalias, prefer Account: login, logout, whoami Snapshots: saved, save, check-snapshot, restore, forget Device: model, reboot, recovery ... Other: warnings, okay, known, ack, version Development: download, pack, run, try For more information about a command, run 'snap help <command>'. For a short summary of all commands, run 'snap help --all'. ``` ### Experiments - Running `snap search zip --narrow` ```shell= Name Version Publisher Notes Summary zipstream 0.18.7 mamantoha - Easily share files and directories over the network telegram-desktop 3.2.2 telegram.desktop - Telegram Desktop ark 19.08.0 kde✓ - Work with file archives p7zip-desktop 16.02.2 ernytech - P7Zip - Desktop exelearning 2.6 exelearning-project - Your Free and Open Source Editor to create Educational Resources. opencomic 0.2.1 ollm - OpenComic sharik-app 3.1 marchellodev - An open-source, cross-platform solution for sharing files within a local network costumemaster-reloaded 1.0.0 ubunturox104 - Switch costume. Solve puzzles. Wake up. kubu 1.1.4 mrsoir - The Kubu File Manager puts emphasis on a clean look and makes it easy to render, search and traverse your file system. b1freearchiver 1.5.86.4890 claudioandre-br - Free file archiver and encryption software mymonero 1.2.1 tekkzbadger - MyMonero docker-image-save 1.6.6 jadolg - Download zip compressed Docker images. irpf2017 1.0 claudioandre-br - Programa do IRPF 2017 telegram-testbart 1.7.7 snap-retiring - A cloud-based messaging app with a focus on security and speed. ``` ### Recipes / Containers / Bundles snap does not have recipes, where the recipe tells what to install as dependencies. rather comes as a bundle containing all it needs. - Directory `/var/lib/snapd/snaps` generally holds all the bundles (.snap files) - Each snap runs in its own **containerized sandbox** - Auto updates - Larger in size ### Supports - Linux Distributions ## [Homebrew/brew](https://brew.sh/) Homebrew is the easiest and most flexible way to install the UNIX tools Apple didn’t include with macOS. It can also install software not packaged for your Linux distribution to your home directory without requiring sudo. - Install package `brew install pkgname` - Checking all commands and flags `man brew` ### Basic Commands ```shell= Example usage: brew search TEXT|/REGEX/ brew info [FORMULA|CASK...] brew install FORMULA|CASK... brew update brew upgrade [FORMULA|CASK...] brew uninstall FORMULA|CASK... brew list [FORMULA|CASK...] Troubleshooting: brew config brew doctor brew install --verbose --debug FORMULA|CASK Contributing: brew create URL [--no-fetch] brew edit [FORMULA|CASK...] Further help: brew commands brew help [COMMAND] man brew https://docs.brew.sh ``` ### Recipes - Uses Ruby - Structure ```shell= class Wget < Formula homepage "https://www.gnu.org/software/wget/" url "https://ftp.gnu.org/gnu/wget/wget-1.15.tar.gz" sha256 "52126be8cf1bddd7536886e74c053ad7d0ed2aa89b4b630f76785bac21695fcd" def install system "./configure", "--prefix=#{prefix}" system "make", "install" end end ``` ### Example ```shell= class HelloWorld < Formula desc "Rust that simply prints 'Hello, world!'" homepage "https://github.com/JLDLaughlin/homebrew_hello_world" url "https://github.com/JLDLaughlin/rust_hello_world/releases/download/0.1.0/hello.tar.gz" version "0.1.0" sha256 "fd68121200c67ae5f3b4856a7061e5070ac4c64c0b293134e0889e257d6f34f4" depends_on "rust" => :build def install system "cargo", "build", "--release", "--bin", "hello" bin.install "target/release/hello" end test do # This test is not good! system "#{bin}/hello", "--version" end end ``` ### Supports - MacOS - Linux ## Difference between -arg and --arg It is a matter of convention. POSIX standard programs usually only have single character options, and they're all prefixed with a single hyphen. The longer versions are a GNU improvement for clarity, as far as I can tell, and usually are prefixed with double hyphens. You can see this in the libraries and programs used to parse options - getopt and gnu-getopt respectively. Non-GNU and non-POSIX-compliant programs may do something else altogether. Note that you really can't be sure that the long form of an argument may be the same from program to program. -f usually means --force, but not with apt-get install (common misconception). -v may mean version - usually, or --verbose, and so on. Check the man pages or other documentation to be sure. ## Summary/Compare - Install - Choco `choco install pkgname -y` - install command supports flags - Snap `snap install pkgname` - install command supports flags - Brew `brew install pkgname` - install command does not support any flags - Recipes - Choco - Uses powershell scripts - Snap - No recipes - Bundles everything to `.snap` file - Brew - Uses ruby - Uses Git - Works On - Choco - Windows - Snap - Linux, Possible for development : MacOs, Windows - Brew - MacOs, Linux ## Links - [everything-you-need-to-know-about-snap-and-snap-store](https://www.makeuseof.com/everything-you-need-to-know-about-snap-and-snap-store/) - [how-does-homebrew-work-starring-rust](https://jldlaughlin.medium.com/-94ae5aa24552) ## Need To Learn - brew bottles, nuget, filesystem image, cmdlets, powershell, powershell objects