├── .gitignore ├── .gitmodules ├── HELP.txt ├── LICENSE.md ├── README.md ├── ash ├── core_modules └── module_aliases.yaml ├── global_modules └── .gitignore └── install.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "core_modules/logger"] 2 | path = core_modules/github.com/ash-shell/logger 3 | url = https://github.com/ash-shell/logger.git 4 | [submodule "core_modules/obj"] 5 | path = core_modules/github.com/ash-shell/obj 6 | url = https://github.com/ash-shell/obj.git 7 | [submodule "core_modules/yaml-parse"] 8 | path = core_modules/github.com/ash-shell/yaml-parse 9 | url = https://github.com/ash-shell/yaml-parse.git 10 | [submodule "core_modules/github.com/ash-shell/apm"] 11 | path = core_modules/github.com/ash-shell/apm 12 | url = https://github.com/ash-shell/apm.git 13 | [submodule "core_modules/github.com/ash-shell/test"] 14 | path = core_modules/github.com/ash-shell/test 15 | url = https://github.com/ash-shell/test.git 16 | [submodule "core_modules/github.com/ash-shell/env"] 17 | path = core_modules/github.com/ash-shell/env 18 | url = https://github.com/ash-shell/env.git 19 | -------------------------------------------------------------------------------- /HELP.txt: -------------------------------------------------------------------------------- 1 | _| || |_| | / / | (_) / / | | 2 | |_ __ _| | / /| |__ _ _ __ / /_ _ ___| |__ 3 | _| || |_| | / / | '_ \| | '_ \ / / _` / __| '_ \ 4 | |_ __ _|_|/ / | |_) | | | | |/ / (_| \__ \ | | | 5 | |_||_| (_)_/ |_.__/|_|_| |_/_/ \__,_|___/_| |_| 6 | 7 | Ash Version 0.1.0 8 | 9 | Welcome to Ash! Please check out the README located in 10 | your install directory, or over at Github: 11 | 12 | https://github.com/ash-shell/ash 13 | 14 | To check out a list of your modules you can run: 15 | 16 | ``` 17 | ash apm:modules 18 | ``` 19 | 20 | If you don't have any modules installed yet, there won't 21 | be any output. If you do have modules, this will list them. 22 | 23 | -------------------- 24 | 25 | Get started by installing your first module! 26 | 27 | ``` 28 | ash apm:install https://github.com/ash-shell/slugify.git --global 29 | ``` 30 | 31 | and for Slugify usage: 32 | 33 | ``` 34 | ash slugify:help 35 | ``` 36 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Brandon Romano 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ash 2 | 3 | [![GitHub release](https://img.shields.io/github/release/ash-shell/ash.svg)](https://github.com/ash-shell/ash) 4 | 5 | Ash is a modular Bash framework written with ease of use + reusability in mind. 6 | 7 | > **Note:** This project is in early development, and versioning is a little different. [Read this](http://markup.im/#q4_cRZ1Q) for more details. 8 | 9 | # Why should you care? 10 | 11 | Building command line tools in Bash is an extremely tedious and somewhat enigmatic task. There's quite a bit of boilerplate code you're going to have to write if you want your script to do more than just one thing, which will only clutter your script. In addition, your scripts will likely never be able to reference good code you've written from old scripts. 12 | 13 | Ash helps you get rid of all of your boilerplate by letting you call functions directly from the command line, while also providing a modular approach to scripting which will allow you to share code between scripts. 14 | 15 | You are able to build a module independently that functions as a CLI or as a library (or any combination of the two), and easily share your module with the world. 16 | 17 | # Installation 18 | 19 | Installing Ash is really straightforward. Here I offer both a [manual install approach](#manually-recommended), and also a [simple one-liner](#via-script) you can paste in your terminal and get started immediately. 20 | 21 | The manual approach is recommended, as you will be more familiar with how Ash is set up. You should probably also never be running scripts from the output of a curl -- but I've still supplied a one-liner as I know a lot of people want a one-liner to get started. 22 | 23 | > It's worth noting that nothing malicious is happening in the one-liner, but you totally shouldn't get in the habit of running `curl https://... | sh` as someone could hypothetially do bad things! 24 | 25 | ### Manually (recommended) 26 | 27 | First, clone down this repo into a place you'd like to keep Ash. We need to add the `--recursive` flag, as Ash has some submodules. 28 | 29 | ``` 30 | git clone --recursive https://github.com/ash-shell/ash.git 31 | ``` 32 | 33 | After you've got the repo cloned down, symlink the `ash` file (located at the root of this repo) to somewhere in your $PATH: 34 | 35 | ```bash 36 | cd /usr/local/bin # <-- This can be anything in your $PATH 37 | ln -s /path/to/ash/repo/ash . 38 | ``` 39 | 40 | You should now be good to go! 41 | 42 | ### via Script 43 | 44 | The script runs [this file](https://raw.githubusercontent.com/ash-shell/ash/master/install.sh). I recommended reading it! There's a possibility this script won't work you, as I do make an assumption that `/usr/local/bin` is in your $PATH. In the event you don't have `/usr/local/bin` in your path, install Ash manually. 45 | 46 | After you've read the install script, run this line right here, and you should be good to go: 47 | 48 | ```bash 49 | curl https://raw.githubusercontent.com/ash-shell/ash/master/install.sh | sh 50 | ``` 51 | 52 | # Modules 53 | 54 | Modules are the fundamental building blocks of Ash. They allow you to build out custom CLI's and libraries that can be used in any other Ash module. 55 | 56 | > In this section I will be building a hypothetical module called `Wrecker` to illustrate usage 57 | 58 | ## Module Structure 59 | 60 | A module looks something like this: 61 | 62 | ``` 63 | ├── ash_config.yaml 64 | ├── callable.sh 65 | ├── classes 66 | │   └── WreckerClass.sh 67 | | └── ... 68 | └── lib 69 | | └── wrecker_library_file.sh 70 | | └── ... 71 | └── test.sh 72 | ``` 73 | 74 | > Feel free to add any folders or files you want to this -- this is simply the base structure that Ash uses. You can't break anything by adding new folders or files. You'll see I've even done this myself in [ash-make](https://github.com/ash-shell/ash-make). 75 | 76 | #### ash_config.yaml 77 | 78 | This is the only required file in an Ash module. This file tells Ash that your project is an Ash module. 79 | 80 | Here is an example `ash_config.yaml` file: 81 | 82 | ```yaml 83 | name: Wrecker 84 | package: github.com/ash-shell/wrecker 85 | default_alias: wrecker 86 | callable_prefix: Wrecker 87 | test_prefix: Wrecker 88 | ``` 89 | 90 | **`name`**: This is the human readable name of your module. This value is used by other modules who might want to output the name of the current module. This field is **required**. 91 | 92 | **`package`**: This is the unique identifier to your project. I strongly suggest keeping this the same as your git project url, or at minimum scoped under a domain you own to prevent any collisions with other ash modules. This field is **required**. 93 | 94 | **`default_alias`**: This is the default alias of your project. When you install a module, it has to be aliased so it can reasonably be called by ash from the command line. This value should be something short and sweet, and you don't need to worry about collisions with other packages (the user will be asked to come up with a new alias in the event there is a collision). This field is **required**. 95 | 96 | **`callable_prefix`**: This field specifies the function prefix that Ash looks for in the callable file when calling upon a module (more detail in [the section below](#callable-modules)). This field is only required for modules that provide a callable file. 97 | 98 | **`test_prefix`**: This field specifies the function prefix that [Test](https://github.com/ash-shell/test) looks for in the `test.sh` file when running tests. This field is only required when you want to add tests to your module. 99 | 100 | #### callable.sh 101 | 102 | This file is only required if you want your library to be callable. The contents of this file are explained in [this section](#callable-modules). 103 | 104 | #### classes/ 105 | 106 | This directory is where you would place your modules classes. Only class files at the root of this directory will be usable. This is an optional folder. 107 | 108 | The README of [ash-shell/obj](https://github.com/ash-shell/obj) goes into full detail of how this all works. 109 | 110 | > TLDR: Ash has native Bash object support 111 | 112 | #### lib/ 113 | 114 | This is another optional directory. If you want your module to provide a functional based library, this is where you would place those files. 115 | 116 | Other packages will be able to import all of the root files in the `lib` directory via: 117 | 118 | ```bash 119 | Ash__import "your/modules/package/name" 120 | ``` 121 | 122 | You can nest folders inside of `lib` for structure, but you'll need to manage importing those files yourself as `Ash__import` won't import them. 123 | 124 | Files in the `lib` directory are auto loaded for you in the callable portions of your module, so you don't have to import your own module. 125 | 126 | #### test.sh 127 | 128 | This is the file in which you can write unit tests for your modules. 129 | 130 | The README of [ash-shell/test](https://github.com/ash-shell/test) goes into full detail of how this all works. 131 | 132 | ## Callable Modules 133 | 134 | You can build your module to be directly callable from the command line. 135 | 136 | The first thing you will need to do in your module is add `callable_prefix` to your [ash_config.yaml](#ash_configyaml) file. 137 | 138 | ```yaml 139 | callable_prefix: Wrecker 140 | ``` 141 | 142 | Now you can create a `callable.sh` file and add it to the root of your module. 143 | 144 | > One of the most important things to understand about callable files is that they are just bash files. They provide immediate access all variables set in the [ash file](/ash), and import all of the [core module libraries](/core_modules). 145 | 146 | Your newly created callable file will look something like this: 147 | 148 | ```bash 149 | #!/bin/bash 150 | 151 | Wrecker__callable_echo(){ 152 | echo "Hello Echo" 153 | } 154 | 155 | Wrecker__callable_main(){ 156 | echo "Hello" 157 | normal_bash_function 158 | } 159 | 160 | normal_bash_function(){ 161 | echo "World" 162 | } 163 | ``` 164 | 165 | #### Callable Functions 166 | 167 | Callable functions are functions that can be called directly from the command line. 168 | 169 | If your module is installed and aliased as `wrecker`, you can call the callable functions from the command line. 170 | 171 | To call the `Wrecker__callable_echo`, simply call this in the command line: 172 | 173 | ```bash 174 | ash wrecker:echo 175 | ``` 176 | 177 | To call `Wrecker__callable_main`, simply call this in the command line: 178 | 179 | ```bash 180 | ash wrecker:main 181 | ``` 182 | 183 | `main` is actually a magical name for a callable, as you can simply call the main callable like this: 184 | 185 | ```bash 186 | ash wrecker 187 | ``` 188 | 189 | ## Library Modules 190 | 191 | Library modules are modules who provide either a `lib` and/or `classes` directory. Modules can be both callable and library modules at the same time. 192 | 193 | #### Ash__import 194 | 195 | `Ash__import` is how modules load in other modules `lib/` files. You pass this function the package name of another module to import it. 196 | 197 | Example usage: 198 | 199 | ```bash 200 | Ash__import "github.com/ash-shell/slugify" 201 | ``` 202 | 203 | #### Obj__import 204 | 205 | > This is technically an [ash-shell/obj](https://github.com/ash-shell/obj) function, so check out that projects README to get a deeper understanding. 206 | 207 | `Obj__import` is how modules load in other modules `class/` files. You pass this function the package name of another module, and also an alias for that module. 208 | 209 | ```bash 210 | Obj__import "github.com/ash-shell/wrecker" "wrecker" 211 | ``` 212 | 213 | # The .ashrc File 214 | 215 | The `.ashrc` file is a file loaded in by the Ash core which you can use in configuring your modules. The `.ashrc` file is located in your home directory `~/.ashrc` (you're going to have to create this file yourself). 216 | 217 | This file is optional in terms of the Ash core, but may be required for some modules that require an `.ashrc` configuration. 218 | 219 | It's worth noting that this is the *first* thing that is loaded in Ash, so module writers don't have to worry about a users `.ashrc` causing any variable/function collisions with their modules, as everything in your module is loaded after and will take priority. 220 | 221 | # License 222 | 223 | [MIT](LICENSE.md) 224 | -------------------------------------------------------------------------------- /ash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ################################################## 4 | # _| || |_| | / / | (_) / / | | 5 | #|_ __ _| | / /| |__ _ _ __ / /_ _ ___| |__ 6 | # _| || |_| | / / | '_ \| | '_ \ / / _` / __| '_ \ 7 | #|_ __ _|_|/ / | |_) | | | | |/ / (_| \__ \ | | | 8 | # |_||_| (_)_/ |_.__/|_|_| |_/_/ \__,_|___/_| |_| 9 | ################################################## 10 | 11 | # ========== Types ========== 12 | 13 | # Booleans 14 | Ash__TRUE=0 # "No Errors" 15 | Ash__FALSE=1 # "Has Errors" 16 | 17 | # Platforms 18 | Ash__PLATFORM_UNKNOWN='unknown' 19 | Ash__PLATFORM_LINUX='linux' 20 | Ash__PLATFORM_FREEBSD='freebsd' 21 | Ash__PLATFORM_DARWIN='darwin' 22 | 23 | # ========== Directories + Files ========== 24 | 25 | Ash__CONFIG_FILENAME="ash_config.yaml" 26 | Ash__MODULES_FILENAME="ash_modules.yaml" 27 | Ash__MODULES_FOLDERNAME="ash_modules" 28 | Ash__MODULE_CALLABLE_FILE="callable.sh" 29 | Ash__MODULE_LIB_DIRECTORY="lib" 30 | Ash__GLOBAL_MODULES_DIRECTORY="global_modules" 31 | Ash__CORE_MODULES_DIRECTORY="core_modules" 32 | Ash__MODULE_CLASSES_DIRECTORY="classes" 33 | Ash__MODULE_ALIASES_FILE="module_aliases.yaml" 34 | Ash__CALL_DIRECTORY="$( pwd )" 35 | Ash__SOURCE_FILE=$(readlink ${BASH_SOURCE[0]}) 36 | Ash__SOURCE_DIRECTORY="$(dirname "$Ash__SOURCE_FILE")" 37 | Ash__ACTIVE_MODULE_DIRECTORY="" # Determined at runtime 38 | Ash__RC_FILE="$HOME/.ashrc" 39 | 40 | ################################################# 41 | # Determines the active platform and wraps the 42 | # result into an enumerated easily testable value 43 | ################################################# 44 | Ash__get_active_platform() { 45 | local platform="$Ash__PLATFORM_UNKNOWN" 46 | local uname_string=$(uname) 47 | if [[ "$uname_string" == 'Linux' ]]; then 48 | platform="$Ash__PLATFORM_LINUX" 49 | elif [[ "$uname_string" == 'FreeBSD' ]]; then 50 | platform="$Ash__PLATFORM_FREEBSD" 51 | elif [[ "$uname_string" == 'Darwin' ]]; then 52 | platform="$Ash__PLATFORM_DARWIN" 53 | fi 54 | 55 | echo "$platform" 56 | } 57 | 58 | ################################################# 59 | # Imports the ashrc file, if it exists 60 | ################################################# 61 | Ash_import_ashrc() { 62 | if [[ -e "$Ash__RC_FILE" ]]; then 63 | . "$Ash__RC_FILE" 64 | fi 65 | } 66 | 67 | ################################################# 68 | # Autoloads an entire directory, non recursive. 69 | # 70 | # @param $1: The directory to autoload 71 | ################################################# 72 | Ash_autoload() { 73 | for file in "$1"/*; do 74 | if [[ -f "$file" ]]; then 75 | . "$file" 76 | fi 77 | done 78 | } 79 | 80 | ################################################# 81 | # Autoloads a modules lib directory. 82 | # Exits if it fails to find the lib directory. 83 | # 84 | # @param $1: The module to load 85 | # @param $2: 1 if we should check aliases, 0 otherwise 86 | # it is safe to omit this parameter if you don't 87 | # need to check aliases 88 | ################################################# 89 | Ash__import() { 90 | local module_directory="$(Ash__find_module_directory "$1" "$2")" 91 | if [[ -d "$module_directory" ]]; then 92 | Ash_autoload "$module_directory/$Ash__MODULE_LIB_DIRECTORY" 93 | else 94 | Logger__error "Attempted to import $1 but could not find module" 95 | exit 96 | fi 97 | } 98 | 99 | ################################################# 100 | # Finds the module directory 101 | # 102 | # Checks local first, then checks global if 103 | # there is nothing in global 104 | # 105 | # @param $1: The module to find 106 | # @param $2: 1 if we should check aliases, 0 otherwise 107 | ################################################# 108 | Ash__find_module_directory() { 109 | local directory="" 110 | 111 | # Checking Core 112 | local core_module_directory="$Ash__SOURCE_DIRECTORY/$Ash__CORE_MODULES_DIRECTORY" 113 | directory=$(Ash_find_module_directory_single "$1" "$2" "$core_module_directory") 114 | if [[ "$directory" != "" ]]; then 115 | echo "$directory" 116 | return 117 | fi 118 | 119 | # Checking Local 120 | local local_module_directory="$Ash__CALL_DIRECTORY/$Ash__MODULES_FOLDERNAME" 121 | directory=$(Ash_find_module_directory_single "$1" "$2" "$local_module_directory") 122 | if [[ "$directory" != "" ]]; then 123 | echo "$directory" 124 | return 125 | fi 126 | 127 | # Checking Global 128 | local global_module_directory="$Ash__SOURCE_DIRECTORY/$Ash__GLOBAL_MODULES_DIRECTORY" 129 | directory=$(Ash_find_module_directory_single "$1" "$2" "$global_module_directory") 130 | if [[ "$directory" != "" ]]; then 131 | echo "$directory" 132 | return 133 | fi 134 | } 135 | 136 | ################################################# 137 | # Attempts to find a modules directory from 138 | # a single module location 139 | # 140 | # @param $1: The module to find 141 | # @param $2: 1 if we should check aliases, 0 otherwise 142 | # @param $3: The module directory to check in 143 | ################################################# 144 | Ash_find_module_directory_single() { 145 | local module="$1" 146 | local check_aliases="$2" 147 | local module_directory="$3" 148 | 149 | # Checking if we should expand aliases 150 | if [[ "$check_aliases" -eq 1 ]]; then 151 | local aliases_file="$module_directory/$Ash__MODULE_ALIASES_FILE" 152 | if [[ -f "$aliases_file" ]]; then 153 | # Expanding aliases 154 | eval $(YamlParse__parse "$aliases_file" "Ash_alias_") 155 | 156 | local alias_variable="Ash_alias_$module" 157 | if [[ ${!alias_variable} != "" ]]; then 158 | module=${!alias_variable} 159 | fi 160 | fi 161 | fi 162 | 163 | # Checking if module directory exists 164 | local module="$module_directory/$module" 165 | if [[ -d $module ]]; then 166 | echo "$module" 167 | return 168 | fi 169 | } 170 | 171 | ################################################# 172 | # This function will echo 1 if $1 is a function, 173 | # 0 otherise. 174 | # 175 | # @param $1: The string to test if it's a function 176 | ################################################# 177 | Ash__is_function() { 178 | if [ -n "$(type -t "$1")" ] && [ "$(type -t "$1")" = function ]; then 179 | echo 1 180 | else 181 | echo 0 182 | fi 183 | } 184 | 185 | # =============================================================== 186 | # ========================= Dispatch ============================ 187 | # =============================================================== 188 | 189 | ################################################# 190 | # Loads the correct module's callable file 191 | # to be ready to be called 192 | # 193 | # All callable functions will be called with 194 | # {module}:{function_name}. This function parses 195 | # out both components and handles them appropriately. 196 | # 197 | # @params $@: All parameters passed to Ash 198 | ################################################# 199 | Ash_dispatch() { 200 | local position=1 201 | IFS=':' read -ra segment <<< "$1" 202 | for part in "${segment[@]}"; do 203 | if [[ "$position" -eq 1 ]]; then 204 | Ash_load_callable_file "$part" 205 | if [[ $? -ne 0 ]]; then 206 | Logger__error "Module '$part' is unknown" 207 | return 208 | fi 209 | Ash__import "$part" "1" 210 | elif [[ "$position" -eq 2 ]]; then 211 | Ash_execute_callable "$part" "${@:2}" 212 | return 213 | fi 214 | position=$((position+1)) 215 | done 216 | 217 | # Can only reach here if didn't have two parts 218 | Ash_execute_callable "main" "${@:2}" 219 | } 220 | 221 | ################################################# 222 | # Loads the correct module callable file 223 | # 224 | # @param $1: The module name 225 | ################################################# 226 | Ash_load_callable_file() { 227 | Ash__ACTIVE_MODULE_DIRECTORY="$(Ash__find_module_directory "$1" "1")" 228 | local callable_file="$Ash__ACTIVE_MODULE_DIRECTORY/$Ash__MODULE_CALLABLE_FILE" 229 | if [ -e "$callable_file" ]; then 230 | # Loading up callable file 231 | . "$callable_file" 232 | 233 | # Loading in config 234 | local config="$Ash__ACTIVE_MODULE_DIRECTORY/$Ash__CONFIG_FILENAME" 235 | eval $(YamlParse__parse "$config" "Ash_module_config_") 236 | 237 | # Setting the Obj "this" package 238 | Obj__import "$Ash_module_config_package" "$Obj__THIS" 239 | 240 | # Updating Logger's prefix 241 | Logger__set_prefix "$Ash_module_config_name" 242 | else 243 | return 1 244 | fi 245 | } 246 | 247 | ################################################# 248 | # Dispatches the proper function from the loaded 249 | # module 250 | # 251 | # @param $1: The function name 252 | # @param ${@:2} All parameters to the callable 253 | ################################################# 254 | Ash_execute_callable() { 255 | # Checking if callable 256 | if [[ -z "$Ash_module_config_callable_prefix" ]]; then 257 | Logger__error "Cannot execute any callables, as 'callable_prefix' is not set in this module's ash_config.yaml" 258 | return 259 | fi 260 | 261 | # Executing the callable function if it exists 262 | local function="$Ash_module_config_callable_prefix"__callable_"$1" 263 | if [[ "$(Ash__is_function "$function")" -eq 1 ]]; then 264 | $function "${@:2}" 265 | else 266 | Logger__error "Callable '$1' is unknown" 267 | fi 268 | } 269 | 270 | ################################################# 271 | # Displays some basic help/usage for Ash 272 | ################################################# 273 | Ash_help() { 274 | echo 275 | more "$Ash__SOURCE_DIRECTORY/HELP.txt" 276 | exit 277 | } 278 | 279 | ################################################# 280 | # Imports all of the libraries needed by 281 | # the core to run 282 | ################################################# 283 | Ash_import_core() { 284 | Ash__import "github.com/ash-shell/logger" 285 | Ash__import "github.com/ash-shell/yaml-parse" 286 | Ash__import "github.com/ash-shell/obj" 287 | Ash__import "github.com/ash-shell/env" 288 | } 289 | 290 | ################################################# 291 | # The entry point function 292 | ################################################# 293 | Ash_start() { 294 | # Import ashrc file 295 | Ash_import_ashrc 296 | 297 | # Checking if user needs help 298 | if [[ -z "$1" || "$1" = "--help" ]]; then 299 | Ash_help 300 | fi 301 | 302 | # Importing the core 303 | Ash_import_core 304 | 305 | # Load Env File 306 | Env__load 307 | 308 | # Updating Logger prefix 309 | Logger__set_prefix "Ash" 310 | 311 | # Dispatching to module 312 | Ash_dispatch "$@" 313 | } 314 | 315 | Ash_start "$@" 316 | -------------------------------------------------------------------------------- /core_modules/module_aliases.yaml: -------------------------------------------------------------------------------- 1 | apm: github.com/ash-shell/apm 2 | logger: github.com/ash-shell/logger 3 | obj: github.com/ash-shell/obj 4 | yamlparse: github.com/ash-shell/yaml-parse 5 | test: github.com/ash-shell/test 6 | env: github.com/ash-shell/env 7 | -------------------------------------------------------------------------------- /global_modules/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | script_location="/usr/local" 3 | path_location="/usr/local/bin" 4 | current_location="$(pwd)" 5 | 6 | # Clone 7 | cd "$script_location" 8 | git clone --recursive https://github.com/ash-shell/ash.git 9 | 10 | # Add to $PATH 11 | cd "$path_location" 12 | ln -s "$script_location/ash/ash" . 13 | echo "Ash successfully installed to $script_location/ash" 14 | 15 | # Move back 16 | cd "$current_location" 17 | --------------------------------------------------------------------------------