Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #58

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# - Redirects error output (if any) to /dev/null to maintain a clean output.
#
parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
git branch 2>/dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}

# Function: gsquash
Expand All @@ -58,7 +58,7 @@ parse_git_branch() {
# Make sure you are on the branch where you want to squash commits before running this command.
#
gsquash() {
git rebase -i HEAD~"${1}"
git rebase -i HEAD~"${1}"
}

###################################################################################################
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"image": "mcr.microsoft.com/devcontainers/base:noble",
"mounts": [
"source=${localWorkspaceFolder:-.}/snippets,target=${containerWorkspaceFolder}/.vscode,type=bind,consistency=cached,readonly"
"source=${localWorkspaceFolder}/snippets,target=${containerWorkspaceFolder}/.vscode,type=bind,consistency=cached"
],
"postCreateCommand": "chmod +x ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh && ${containerWorkspaceFolder}/.devcontainer/postCreateScript.sh",
"runArgs": [
Expand Down
28 changes: 25 additions & 3 deletions .devcontainer/postCreateScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
###################################################################################################
# Global Variables & Constants
###################################################################################################
readonly SNIPPETS_DIR="snippets"
readonly VSCODE_DIR=".vscode"
readonly SNIPPET_FILES_PATTERN="*.code-snippets"

readonly ALIAS_FILE_LINK="https://raw.githubusercontent.com/gvatsal60/Linux-Aliases/HEAD/install.sh"

Expand All @@ -41,8 +44,27 @@ readonly ALIAS_FILE_LINK="https://raw.githubusercontent.com/gvatsal60/Linux-Alia
# Install Linux aliases from external script using curl and execute immediately
# Note: Make sure to review scripts fetched from external sources for security reasons
if command -v curl >/dev/null 2>&1; then
curl -fsSL ${ALIAS_FILE_LINK} | sh
curl -fsSL ${ALIAS_FILE_LINK} | sh
else
echo "Error: curl is not installed. Unable to use Linux aliases"
exit 1
echo "Error: curl is not installed. Unable to use Linux aliases"
exit 1
fi

# As bind mounts not supported in GitHub Codespaces
if [ -n "${CODESPACE_NAME}" ]; then
# Generate symlinks for snippet files
# Create the .vscode directory if it doesn't already exist.
mkdir -p "${VSCODE_DIR}"
# Unlink all symbolic links in the '.vscode' directory
find "${VSCODE_DIR}" -type l -name "${SNIPPET_FILES_PATTERN}" | while read -r file; do
unlink "${file}"
done
# Check if the 'snippets' directory exists
if [ -d "${SNIPPETS_DIR}" ]; then
# Find all .code-snippet files in the 'snippets' directory and create symbolic links
find "${SNIPPETS_DIR}" -type f -name "${SNIPPET_FILES_PATTERN}" | while read -r file; do
# Create a symbolic link in '.vscode' with the same base name
ln -s "$(realpath "${file}")" "${VSCODE_DIR}/$(basename "${file}")"
done
fi
fi
32 changes: 0 additions & 32 deletions .github/workflows/ShellCheck.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions .markdownlint.yaml

This file was deleted.

5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ repos:
args: [--autofix]
- id: requirements-txt-fixer
- id: trailing-whitespace
# Shell formatting with shfmt
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.10.0-1
hooks:
- id: shfmt
# ShellCheck hook for linting shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
Expand Down
38 changes: 27 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,42 @@ Please follow these guidelines to ensure a smooth process.

### General Guidelines

- **Indentation**: Use 4 spaces for indentation in all code files. Avoid using tabs.
- **Indentation**: Use 4 spaces for indentation in all code files.
Avoid using tabs.
- **Line Length**: Limit lines to improve readability.
- **Naming Conventions**: Use meaningful variable and function names. Variables should be written in lowercase with underscores separating words (e.g., `my_variable`), while function names should use lowercase with underscores (e.g., `my_function`).
- **Naming Conventions**: Use meaningful variable and function names.
Variables should be written in lowercase with underscores separating words
(e.g., `my_variable`), while function names should use lowercase with
underscores (e.g., `my_function`).

### Bash Scripts

- **Indentation**: Use 4 spaces for indentation. Ensure consistent indentation throughout the script.
- **POSIX Compliance**: Write scripts to be POSIX-compliant whenever possible to ensure compatibility across different Unix-like systems. Avoid using non-standard features or extensions specific to a particular shell.
- **Quoting**: Always quote variable expansions (e.g., `"${variable}"`) to prevent issues with spaces or special characters.
- **Shebang**: Use `#!/bin/sh` for POSIX-compliant scripts. If specific shell features are needed, document the specific shell requirement in the script header.
- **Function Definitions**: Define functions without `function` keyword (e.g., `my_function() { ... }`). Consistency is key.
- **Comments**: Use comments to explain complex logic or provide context. Keep comments concise and relevant.
- **Indentation**: Use 4 spaces for indentation.
Ensure consistent indentation throughout the script.
- **POSIX Compliance**: Write scripts to be POSIX-compliant
whenever possible to ensure compatibility across different Unix-like systems.
Avoid using non-standard features or extensions specific to a particular shell.
- **Quoting**: Always quote variable expansions (e.g., `"${variable}"`)
to prevent issues with spaces or special characters.
- **Shebang**: Use `#!/bin/sh` for POSIX-compliant scripts.
If specific shellfeatures are needed, document the specific shell
requirement in the script header.
- **Function Definitions**: Define functions without `function` keyword
(e.g., `my_function() { ... }`). Consistency is key.
- **Comments**: Use comments to explain complex logic or provide context.
Keep comments concise and relevant.
- **Error Handling**: Include error handling for critical operations.
- **External Commands**: Prefer using built-in commands and utilities when possible. Minimize the use of external commands to improve script portability and performance.
- **External Commands**: Prefer using built-in commands and
utilities when possible. Minimize the use of external commands
to improve script portability and performance.

## Reporting Bugs

Please report bugs using the GitHub issue tracker. Include steps to reproduce the bug and
Please report bugs using the GitHub issue tracker.
Include steps to reproduce the bug and
any relevant error messages.

## Contact

If you have questions or need further assistance, feel free to contact us at [Telegram](https://t.me/gvatsal60).
If you have questions or need further assistance, feel free to
contact us at [Telegram](https://t.me/gvatsal60).
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Linux-Aliases 🖥️

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://img.shields.io/github/license/gvatsal60/Linux-Aliases)
[![build status](https://github.com/gvatsal60/Linux-Aliases/actions/workflows/ShellCheck.yaml/badge.svg)](https://github.com/gvatsal60/Linux-Aliases/actions/workflows/ShellCheck.yaml)
[![Markdown Lint](https://github.com/gvatsal60/Linux-Aliases/actions/workflows/readme-checker.yaml/badge.svg)](https://github.com/gvatsal60/Linux-Aliases/actions/workflows/readme-checker.yaml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/gvatsal60/Linux-Aliases/master.svg)](https://results.pre-commit.ci/latest/github/gvatsal60/Linux-Aliases/HEAD)
[![CodeFactor](https://www.codefactor.io/repository/github/gvatsal60/linux-aliases/badge)](https://www.codefactor.io/repository/github/gvatsal60/linux-aliases)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-Yes-green.svg)](https://GitHub.com/gvatsal60/Linux-Aliases/graphs/commit-activity)
![GitHub pull-requests](https://img.shields.io/github/issues-pr/gvatsal60/Linux-Aliases)
![GitHub Issues](https://img.shields.io/github/issues/gvatsal60/Linux-Aliases)
Expand Down Expand Up @@ -34,7 +35,7 @@
1. Run the following command in your terminal:

```sh
curl -fsSL https://raw.githubusercontent.com/gvatsal60/Linux-Aliases/HEAD/install.sh | sh

Check failure on line 38 in README.md

View workflow job for this annotation

GitHub Actions / lint

Line length

README.md:38:81 MD013/line-length Line length [Expected: 80; Actual: 93] https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md013.md

Check failure on line 38 in README.md

View workflow job for this annotation

GitHub Actions / lint

Line length

README.md:38:81 MD013/line-length Line length [Expected: 80; Actual: 93] https://github.com/DavidAnson/markdownlint/blob/v0.36.1/doc/md013.md
```

2. Depending on your operating system, you might need to
Expand Down
Loading
Loading