Skip to content

Commit 7a92891

Browse files
committed
Add help and license terms to sources/*
To: - sources/alias_of.sh - sources/cd-finddir.sh - sources/cd-to-git-root.sh - sources/cd-to-node-root.sh - sources/contains_value.sh - sources/force-unexport.sh - sources/i_have.sh - sources/is_array.sh - sources/load-my-env.sh - sources/source_if_exists.sh
1 parent a74e06d commit 7a92891

File tree

10 files changed

+28
-18
lines changed

10 files changed

+28
-18
lines changed

sources/alias_of.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

3-
# If $1 exists, create an alias for $1 with the contents of $2 and overwrite it.
3+
# If `$1` exists, create an alias for `$1` with the contents of `$2` and overwrite it.
44
#
5-
# Example:
65
# ```shell-session
76
# $ alias_of rg 'rg --color always --hidden'
87
# $ alias rg

sources/cd-finddir.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash
22

3-
#
43
# Shows all directories of 6 depth (if `fd` is available, or 3 depth for `find`), and cd to a directory you selected.
54
#
5+
# ```shell-session
6+
# TODO: Write an example
7+
# ```
68

79
dir="$(cd -- "$(dirname -- "${BASH_SOURCE:-$0}")" && pwd || exit 1)"
810

sources/cd-to-git-root.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
22

3+
# `cd` to the git root directory.
4+
# The behavior when Atata is on a Windows file system with WSL is also supported.
35
#
4-
# `cd` to the git root directory
5-
# With `wslpath` support.
6-
# Try using `wslpath`.
7-
# This is often useful if you are in a git directory of Windows filesystem.
8-
#
6+
# ```shell-session
7+
# TODO: Write an example
8+
# ```
99

1010
function cd-to-git-root () {
1111
local root

sources/cd-to-node-root.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash
22

3+
# `cd` to a directory that have a `package.json`.
34
#
4-
# cd to a directory that have a package.json.
5-
#
5+
# ```shell-session
6+
# TODO: Write an example
7+
# ```
68

79
function cd-to-node-root::find-node-root-dir () {
810
local current_dir=$1

sources/contains_value.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
# Example
4-
#
53
# ```bash
64
# target=banana
75
# my_array=(apple banana cherry)

sources/force-unexport.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
22

3-
# Example:
4-
#
3+
# ```shell-session
54
# $ export FOO=1
65
# $ force-unexport FOO
76
# $ [[ -z $FOO ]] && echo yes
87
# yes
8+
# ```
99
#
1010
# See: https://unix.stackexchange.com/questions/252747/how-can-i-un-export-a-variable-without-losing-its-value
1111

sources/i_have.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
# A shorthand to check a specified command does exist or not.
44
#
5-
# Example:
6-
#
75
# ```bash
86
# if i_have batcat ; then
97
# alias bat=batcat

sources/is_array.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/bash
22

3-
# Check a taken var name is an array
3+
# Checks a taken var name is an array.
44
#
5-
# Example:
65
# ```shell-session
76
# $ foo=()
87
# $ is_array foo && echo yes || echo no

sources/load-my-env.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
# TODO: Add the help and the description.
4+
#
5+
# ```shell-session
6+
# TODO: Write an example
7+
# ```
8+
39
function load-my-env () {
410
local target_name="$1"
511

sources/source_if_exists.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
# TODO: Add the help and the description.
4+
#
5+
# ```shell-session
6+
# TODO: Write an example
7+
# ```
8+
39
function source_if_exists () {
410
if [[ -f $1 ]] ; then
511
# shellcheck disable=SC1090

0 commit comments

Comments
 (0)