Skip to content

Commit

Permalink
Initial commit. 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
q60 committed Aug 24, 2021
0 parents commit da83686
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 veleth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NAME = audna
TARGET = bin/audna

.PHONY: build test

all: build test

build:
mkdir -p bin
mv src/main.pl $(TARGET)
chmod +x $(TARGET)

test:
$(TARGET)

install:
install -Dm755 "$(TARGET)" "$(DESTDIR)/usr/bin/$(NAME)"
install -Dm644 "LICENSE" "$(DESTDIR)/usr/share/licenses/$(NAME)/LICENSE"

uninstall:
rm -rfv "$(DESTDIR)/usr/bin/$(NAME)" "$(DESTDIR)/usr/share/licenses/$(NAME)"
39 changes: 39 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
auðna |perl|
=====

**Auðna** (IPA: [ˈøyðna], stylized as *auðna*) is a random quote
fetching console utility. Written in Perl.

|screenshot|

Installing
----------

+ Use latest release from `releases <https://github.com/q60/audna/releases>`__

Building and installing manually
--------------------------------

You need *GNU make* to install **auðna** and *Perl* to use it.

.. code-block:: sh
make
sudo make install
Running
-------

.. code-block:: sh
audna
Uninstalling
------------

.. code-block:: sh
sudo make uninstall
.. |screenshot| image:: https://i.imgur.com/xRTNuVp.png
.. |perl| image:: https://img.shields.io/badge/-Perl-3F416A?style=for-the-badge&logo=perl
22 changes: 22 additions & 0 deletions src/main.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env perl

use Text::Wrap;
$Text::Wrap::columns = 60;

$params = "method=getQuote&format=text&lang=en";
$uri = "https://api.forismatic.com/api/1.0/?$params";

@response = split(/\(/, `curl -s "$uri"`);

$quote_text = $response[0];
$quote_text =~ s/^\s+|\s+$//g;
$quote_text = wrap("", " ", $quote_text);

print "\"\e[94m\e[1m$quote_text\e[0m\"\n";

if ($response[1]) {
$quote_author = $response[1];
$quote_author =~ s/\)//;
$quote_author =~ s/^\s+|\s+$//;
print "\e[93m$quote_author\e[0m\n";
}

0 comments on commit da83686

Please sign in to comment.