Skip to content

Commit

Permalink
Merge pull request #12 from StealthyCoder/release/0.2.2
Browse files Browse the repository at this point in the history
Release/0.2.2
  • Loading branch information
StealthyCoder authored Feb 21, 2020
2 parents 7929cbb + 6553bb9 commit 3f17ea9
Show file tree
Hide file tree
Showing 16 changed files with 552 additions and 30 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ By running the following command you get a nice clean environment in which `cruc

## Core

- [ ] Dates
- [X] Dates
- [X] Logging
- [X] Arrays
- [ ] File I/O
- [ ] Network I/O
- [ ] Processes

# Static Code Analysis

Expand Down
1 change: 1 addition & 0 deletions docker/shellcheck/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ RUN apt update && \
apt install -y shellcheck

RUN echo '#!/usr/bin/env bash\n\
shopt -s dotglob\n\
for f in $(ls /srv/crucible/bash/**/*)\n\
do\n\
if [ -f $f ]; then shellcheck $f -x -s bash; fi\n\
Expand Down
4 changes: 2 additions & 2 deletions src/bash/arrays/arrays.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

require core/.internal
Expand Down
4 changes: 2 additions & 2 deletions src/bash/bin/crucible
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
CRUCIBLE_VERSION=0.2.1
CRUCIBLE_LOCATION=v0.2.1
CRUCIBLE_VERSION=0.2.2
CRUCIBLE_LOCATION=v0.2.2

function get_uuid {
grep 'id' .crucible | cut -d'=' -f 2
Expand Down
4 changes: 2 additions & 2 deletions src/bash/core/.internal.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

require logging/logging
Expand Down
4 changes: 2 additions & 2 deletions src/bash/core/dummy.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

function noop {
Expand Down
4 changes: 2 additions & 2 deletions src/bash/core/mould.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

function require {
Expand Down
9 changes: 9 additions & 0 deletions src/bash/dates/dates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

require dates/utc
require dates/local
116 changes: 116 additions & 0 deletions src/bash/dates/local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

function dates.local.now {
if [ -z "$1" ]
then
date
else
date "$1"
fi

}

function dates.local.now.timestamp {
if [ -z "$1" ]
then
date +%s
else
date +%s "$1"
fi

}

function dates.local.rfc3339.ns {
if [ -z "$1" ]
then
date --rfc-3339=ns
else
date --rfc-3339=ns "$1"
fi

}

function dates.local.rfc3339.seconds {
if [ -z "$1" ]
then
date --rfc-3339=seconds
else
date --rfc-3339=seconds "$1"
fi

}

function dates.local.rfc3339.date {
if [ -z "$1" ]
then
date --rfc-3339=date
else
date --rfc-3339=date "$1"
fi

}

function dates.local.email {
if [ -z "$1" ]
then
date --rfc-email
else
date --rfc-email "$1"
fi

}

function dates.local.iso8601.ns {
if [ -z "$1" ]
then
date --iso-8601=ns
else
date --iso-8601=ns "$1"
fi

}

function dates.local.iso8601.seconds {
if [ -z "$1" ]
then
date --iso-8601=seconds
else
date --iso-8601=seconds "$1"
fi

}

function dates.local.iso8601.minutes {
if [ -z "$1" ]
then
date --iso-8601=minutes
else
date --iso-8601=minutes "$1"
fi

}

function dates.local.iso8601.hours {
if [ -z "$1" ]
then
date --iso-8601=hours
else
date --iso-8601=hours "$1"
fi

}

function dates.local.iso8601.date {
if [ -z "$1" ]
then
date --iso-8601=date
else
date --iso-8601=date "$1"
fi

}
106 changes: 106 additions & 0 deletions src/bash/dates/utc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

function dates.utc.now {
if [ -z "$1" ]
then
date -u
else
date -u "$1"
fi

}

function dates.utc.now.timestamp {
if [ -z "$1" ]
then
date -u +%s
else
date -u +%s "$1"
fi
}

function dates.utc.rfc3339.ns {
if [ -z "$1" ]
then
date -u --rfc-3339=ns
else
date -u --rfc-3339=ns "$1"
fi
}

function dates.utc.rfc3339.seconds {
if [ -z "$1" ]
then
date -u --rfc-3339=seconds
else
date -u --rfc-3339=seconds "$1"
fi
}

function dates.utc.rfc3339.date {
if [ -z "$1" ]
then
date -u --rfc-3339=date
else
date -u --rfc-3339=date "$1"
fi
}

function dates.utc.email {
if [ -z "$1" ]
then
date -u --rfc-email
else
date -u --rfc-email "$1"
fi
}

function dates.utc.iso8601.ns {
if [ -z "$1" ]
then
date -u --iso-8601=ns
else
date -u --iso-8601=ns "$1"
fi
}

function dates.utc.iso8601.seconds {
if [ -z "$1" ]
then
date -u --iso-8601=seconds
else
date -u --iso-8601=seconds "$1"
fi
}

function dates.utc.iso8601.minutes {
if [ -z "$1" ]
then
date -u --iso-8601=minutes
else
date -u --iso-8601=minutes "$1"
fi
}

function dates.utc.iso8601.hours {
if [ -z "$1" ]
then
date -u --iso-8601=hours
else
date -u --iso-8601=hours "$1"
fi
}

function dates.utc.iso8601.date {
if [ -z "$1" ]
then
date -u --iso-8601=date
else
date -u --iso-8601=date "$1"
fi
}
4 changes: 2 additions & 2 deletions src/bash/logging/.constants.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

function logging.color.escape_char {
Expand Down
17 changes: 9 additions & 8 deletions src/bash/logging/.internal.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

require logging/.constants
require dates/utc

function _echo {
echo -e "$1"
Expand All @@ -14,22 +15,22 @@ function _echo {
function _format {
case $1 in
INFO)
_echo "$(__cyan)[ $1 ] $2 $(__reset)"
_echo "$(__cyan)[ $1 ] $(dates.utc.iso8601.ns) $2 $(__reset)"
;;
DEBUG)
_echo "$(__blue)[ $1 ] $2 $(__reset)"
_echo "$(__blue)[ $1 ] $(dates.utc.iso8601.ns) $2 $(__reset)"
;;
WARNING)
_echo "$(__yellow)[ $1 ] $2 $(__reset)"
_echo "$(__yellow)[ $1 ] $(dates.utc.iso8601.ns) $2 $(__reset)"
;;
ERROR)
_echo "$(__red)[ $1 ] $2 $(__reset)"
_echo "$(__red)[ $1 ] $(dates.utc.iso8601.ns) $2 $(__reset)"
;;
SUCCESS)
_echo "$(__green)[ $1 ] $2 $(__reset)"
_echo "$(__green)[ $1 ] $(dates.utc.iso8601.ns) $2 $(__reset)"
;;
*)
_echo "$(__cyan)[ $1 ] $2 $(__reset)"
_echo "$(__cyan)[ $1 ] $(dates.utc.iso8601.ns) $2 $(__reset)"
;;
esac
}
Expand Down
4 changes: 2 additions & 2 deletions src/bash/logging/logging.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
### CRUCIBLE META DATA ###
# CRUCIBLE_VERSION=0.2.1
# CRUCIBLE_VERSION=0.2.2
# CRUCIBLE_AUTHOR=StealthyCoder
# CRUCIBLE_CREATED=1578009741
# CRUCIBLE_CREATED=1582286436
### CRUCIBLE META DATA ###

require logging/.internal
Expand Down
Loading

0 comments on commit 3f17ea9

Please sign in to comment.