GithubHelp home page GithubHelp logo

bashx's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

agonzal

bashx's Issues

Global TEMP dir

Generate global variable for Script-TMP-Dir, where store all temporary files, and cleanup on exit/end.

Generator

Script to generate initial project files and structure.

Implement autocomplete

Example: https://unix.stackexchange.com/a/291867/22180

Here is basic guide.

Lets have an example of script called admin.sh to which you would like to have autocomplete working.

#!/usr/bin/bash

while [ $# -gt 0 ]; do
  arg=$1

  case $arg in
    option_1)
     # do_option_1
    ;;
    option_2)
     # do_option_1
    ;;
    shortlist)
      echo option_1 option_2 shortlist
    ;;
    *)
     echo Wrong option
    ;;
  esac
  
  shift
done

Note option shortlist. Calling script with this option will print out all possible options for this script.

And here you have the autocomplete.sh script:

#!/usr/bin/bash

_script() {
  _script_commands=$(/path/to/your/admin.sh shortlist)

  local cur prev
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  COMPREPLY=( $(compgen -W "${_script_commands}" -- ${cur}) )
  return 0
}

complete -o nospace -F _script /path/to/your/admin.sh

Note that the last argument to complete is the name of the script you want to add autocompletion to. All you need to do is to add your autocomplete script to ~/.bashrc or /etc/bash_completion.d as:

source /full-path/to/your/autocomplete.sh

# or

. /full-path/to/your/autocomplete.sh

Finally, make them executable:

chmod a+x admin.sh autocomplete.sh

Source: https://askubuntu.com/a/483149/24155

Web Installer

Installer like curl -s "https://bashx.webpage/v3/install.sh" | bash

Tests: Implement "warning"

Implement @assertWarning to show warnings on tests.

Use this implementation in "@timeout" when code is not executed (this test is not executed in OSX)

Implement "@temp-file"

Create a function:

  1. Using mktemp, create the file. Throw error on fail.
  2. Register @on-exit event to delete the temp file (See #4 )
  3. Return file path.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.