Coder Social home page Coder Social logo

silum / abs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abs-lang/abs

0.0 0.0 0.0 29.03 MB

Home of the ABS programming language: the joy of shell scripting.

Home Page: https://www.abs-lang.org

License: MIT License

Dockerfile 0.04% Makefile 0.22% Go 99.57% Shell 0.17%

abs's Introduction

abs language logo

GitHub Workflow Status (branch) License Version undefined undefined
undefined undefined Coverage Status
undefined undefined undefined undefined

The ABS programming language

ABS is a programming language that works best when you're scripting on your terminal. It tries to combine the elegance of languages such as Python, or Ruby, to the convenience of Bash.

tz = `cat /etc/timezone`
continent, city = tz.split("/")

echo("Best city in the world?")

selection = stdin()

if selection == city {
  echo("You might be biased...")
}

See it in action:

asciicast

Let's try to fetch our IP address and print the sum of its parts, if its higher than 100. Here's how you could do it in Bash:

# Simple program that fetches your IP and sums it up
RES=$(curl -s 'https://api.ipify.org?format=json' || "ERR")

if [ "$RES" = "ERR" ]; then
    echo "An error occurred"
    exit 1
fi

IP=$(echo $RES | jq -r ".ip")
IFS=. read first second third fourth <<EOF
${IP##*-}
EOF

total=$((first + second + third + fourth))
if [ $total -gt 100 ]; then
    echo "The sum of [$IP] is a large number, $total."
fi

And here's how you could write the same code in ABS:

# Simple program that fetches your IP and sums it up
res = `curl -s 'https://api.ipify.org?format=json'`

if !res.ok {
  echo("An error occurred: %s", res)
  exit(1)
}

ip = res.json().ip
total = ip.split(".").map(int).sum()
if total > 100 {
    echo("The sum of [$ip] is a large number, $total.")
}

Wondering how you can run this code? Simply grab the latest release and run:

$ abs script.abs

Installation

The easiest way is to:

bash <(curl https://www.abs-lang.org/installer.sh)

then you can:

$ abs path/to/scripts.abs

Documentation

Visit abs-lang.org or check the examples directory, which contains a few brief scripts.

Contributing

Wanna hack on ABS locally? The recommended development environment is inside a Docker container -- simply:

  • make build (builds the container)
  • make run (sends you inside the development container)
  • make test (runs the abs tests)

After you make any change, simply run make test and check if any errors pops up. If everything looks fine that means you're ready to open a pull request!

Status

ABS is fresh and under active development, meaning exciting things happen on a weekly basis.

Have a look at the roadmaps here: to know of what version we're currently working on take a look at abs-lang.org/misc/technical-details.

abs's People

Contributors

odino avatar ntwrick avatar mingwho avatar gromgit avatar shidhincr avatar nicerobot avatar sysread avatar palicao avatar dependabot[bot] avatar bad3r avatar andromedarabbit avatar bass3l avatar

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.