56 Commits

Author SHA1 Message Date
ae6becb2cc Updated zrep script to version 0.0.7 with new features and improvements.
- Updated version to 0.0.7
- Added URL-encoding function for search queries
- Implemented search function to query and process JSON response
- Refactored package removal function
- Added check for 'jq' installation
- Improved package installation process
- Enhanced update package functionality
- Added search command to search for authors, packages, or descriptions
2024-04-05 00:36:24 +02:00
8ea89b837b Added search function link to zrep website.
Added note about future search function in zrep script.
2024-04-04 13:12:53 +02:00
e37233009c Update README with information about zrep tool and its usage. Added a section explaining what zrep is and how to share scripts. 2024-04-04 13:07:14 +02:00
6399a20ed1 Updated zrep version to 0.0.6
- Updated version to 0.0.6
- Changed repo_url to https://zrep.kekepower.com
- Added reminder to copy 'zrep' to a directory in 'PATH'
- Added reminder to source ${zshrc_file} after installation.
2024-04-03 13:57:43 +02:00
2e0d42c040 Updated zrep version to 0.0.5
- Updated version to 0.0.5
- Added validation for package name format
- Display error message if package name format is incorrect
2024-04-02 21:57:39 +02:00
8f34150a78 Update zrep script to version 0.0.4
- Updated version number to 0.0.4
- Added timestamp to remoteFile URL
- Improved update_package function logic
- Added prompt for user confirmation before updating
- Updated downloader commands for curl, wget, and wget2
- Improved error handling in download_package function
- Improved installation process in install_package function
2024-03-31 15:14:43 +02:00
c4c384c799 Use PNG instead of SVG for logo 2024-03-17 09:05:41 +01:00
d0fed1720e Update zrep to version 0.0.3. New zrep-logo.svg. Bug fixes and enhancements. 2024-03-17 09:04:23 +01:00
c3962c72a0 Title: Fix debug message in zrep script
- Updated debug message in zrep script to include a newline character.
- Improved error handling for when package is not found.
2024-03-16 00:29:32 +01:00
255649a53e Title: Update zrep function to exit instead of return
- Changed `return 1` to `exit 1` in zrep_parse_remote function.
2024-03-16 00:29:07 +01:00
a64e876b7d Added return statement when package is not found in zrep_parse_remote function.
- Added return 1 when package is not found.
2024-03-16 00:27:27 +01:00
a50a99183b Added touch command to create installed.json if not found.
Included error message for clarity.
2024-03-16 00:18:25 +01:00
fcf519dd68 Added conditional check to load config and theme only if argument is not "init". 2024-03-16 00:14:36 +01:00
dd518d733b Refactor zrep_load_config function in zrep script:
- Indent zrep_init call properly.
- Add else block to handle setup abort.
- Provide feedback message for setup abortion.
2024-03-16 00:11:00 +01:00
7243ae4235 Added user interaction for setting up zrep for the first time.
- Display welcome message when running zrep for the first time.
- Prompt user to set up zrep if config file is not found.
- Added user confirmation before running 'zrep init'.
2024-03-16 00:10:00 +01:00
3345f78b7a Update zrep script:
- Comment out unused variable assignment.
- Add installation path to theme installation message.
- Prompt user to initialize config if not found.
- Provide welcome message for first-time users.
2024-03-16 00:06:08 +01:00
ba1829953c Added directory creation for install_dir
Added autoload for zini
Added creation of .addons file
Added installation of Classic theme
Updated zrep initialization process
2024-03-15 23:58:20 +01:00
03adceec67 Title: Update unzip command in zrep script
- Changed unzip command to use quiet mode
- Ensured overwrite of existing files during extraction
- Improved error handling for unzip operation
2024-03-15 23:23:20 +01:00
7da1c425f4 Title: Fix unzip command order in zrep script
Changes:
- Reordered unzip command options in zrep script for correct execution.
2024-03-15 23:21:29 +01:00
3830e58ebb Update unzip command in zrep script to use -aa flag for better compatibility.
- Use `-aa` flag in unzip command for better compatibility with various zip formats.
2024-03-15 23:19:05 +01:00
4337b13a28 Update zrep script with autoload fix and debug message in zrep_install_package function.
- Fix autoload command in zrep script.
- Add debug message in zrep_install_package function.
2024-03-15 23:14:47 +01:00
e314131622 Update zrep script to display a newline before "No packages installed" message.
Add newline character before the message to improve readability.
2024-03-15 22:56:38 +01:00
b160120893 Update zrep script to handle cases where installed.json is empty or contains no packages. Add checks to handle empty JSON objects or arrays. 2024-03-15 22:55:52 +01:00
d4e355cf32 Update zrep script with improvements in file existence check and script entry handling. Fix JSON file creation and ensure it's not empty. Refactor script entry update/addition logic for better clarity. Rearrange curl command options for zrep_download_package function. 2024-03-15 22:45:37 +01:00
c297c2a551 Update curl command in zrep script for downloading packages. Fix duplicate output redirection. 2024-03-15 22:39:24 +01:00
c92eb49c05 Added conditional check for zrep initialization.
Created files .addons and installed.json during zrep initialization.
2024-03-15 22:35:41 +01:00
17355e5779 Title: Fix downloader selection logic in zrep script
- Fixed logical OR conditions to logical AND in downloader selection.
- Improved user input validation for downloader selection.
- Added error messages for invalid downloader choices.
- Updated zrep script for correct downloader selection logic.
2024-03-15 22:19:23 +01:00
53bd010da6 Title: Update zrep script with downloader choice validation
- Fixed downloader choice validation in zrep_init function
- Moved zrep_fpath and autoload commands to else block for existing config handling
2024-03-15 22:16:33 +01:00
de3bb15662 Title: Update zrep script with enhanced downloader function
- Added user prompt to choose downloader command
- Enhanced zrep_download_package function with retry logic
- Updated zrep_help function for better readability
- Added zrep_package_info function to display package details
2024-03-15 22:10:39 +01:00
17c9058be5 Added 'curl' to the list of required programs in zrep script. 2024-03-15 11:53:45 +01:00
d0210580b1 Refactor zrep_list_installed_packages function
- Added zmodload zsh/regex for regex support
- Changed grep to regex match for package activation check
- Updated zrep_msg output format
2024-03-14 16:24:48 +01:00
40adc05b9b Update zrep script:
- Changed comment to define default path for .zreprc
- Updated comment to define list of colors available for themes
- Removed clearing of previous theme settings
- Added function to check if a string exists in ~/.zshrc
- Added function to check for required dependencies
- Updated zrep_init function to include checking for dependencies
- Updated zrep_init function to create default file and directory structure
- Updated zrep_init function to check for existing zini path in .zshrc
- Updated zrep_init function to check for existing source command for .zrep_addons in .zshrc
- Updated zrep_init function to create or update .zrep_addons file
- Updated zrep_check_for_updates function to display message if no updates found
- Removed redundant message in zrep_update_package function
- Updated zrep_download_package function to display download attempt message
- Updated zrep_download_package function to display download successful message
- Updated zrep_install_package function to include fetching package information
- Removed commented out line in zrep_install_package function
- Removed commented out line in zrep_parse_package_name function
2024-03-13 22:52:47 +01:00
a492260ec9 Update zrep version to 0.0.2
- Updated zrep version to 0.0.2
- Improved error messages for package not found
- Enhanced output messages for installed packages
- Improved error handling for package installation
- Enhanced error messages for package not installed
- Added 'del' alias for 'remove' command
- Improved usage message for 'remove' command
2024-03-13 07:25:59 +01:00
de29949486 Update zrep script with new color scheme and theme loading functionality.
- Added new base_colors associative array for color definitions.
- Implemented zrep_load_theme function to load themes.
- Modified zrep_msg function to use colors from the current theme.
- Updated zrep_version function to use theme colors for help and info.
- Adjusted zrep_list_installed_packages to use base_colors for color definitions.
- Enhanced zrep_update_package with informative messages.
- Added zrep_download_package function for downloading packages.
- Improved zrep_install_package to use zrep_download_package for downloads.
- Updated main function to load the global theme.
2024-03-12 23:52:10 +01:00
7ddcd309c5 Added export statement to fix variable assignment issue in zrep script.
- Fixed variable assignment in zrep script.
2024-03-12 18:07:33 +01:00
548012d7cc Update zrep script with zrep_installed_json function
- Added zrep_installed_json function to handle installed.json existence
- Updated zrep_update_installed_json to use zrep_installed_json
- Updated zrep_list_installed_packages to use zrep_installed_json
- Updated zrep_list_package to use zrep_installed_json
- Updated zrep_remove_package to use zrep_installed_json
- Updated zrep_check_if_installed to use zrep_installed_json
- Updated zrep_check_for_updates to use zrep_installed_json
- Updated zrep_install_package to remove temporary zip files
- Updated zrep_parse_installed_json to use zrep_installed_json
- Updated zrep_parse_package_name to use zrep_installed_json
- Updated zrep_enable and zrep_disable to remove unnecessary sourcing and function calls
- Updated zrep_read_usage to use zrep_installed_json
2024-03-12 18:06:06 +01:00
4d249d2bf1 Update zrep initialization to include global settings and reminder to source zshrc. Check for 'zini' path in fpath before adding. Enhance update logic to handle specific package updates. Improve update messaging and handle no updates found case. Refactor update package function for better readability. Add conditional help message for 'init' command if config file doesn't exist. 2024-03-12 14:58:13 +01:00
849d4e46a4 Updated zrep script to include functions for checking updates, updating specific packages, and installing packages. Added logic to handle package installation, removal, and updating. Improved error handling and messaging for better user experience. Enhanced functionality for managing zrep packages efficiently. 2024-03-11 22:15:43 +01:00
77eb36815b Minor changes and cleanups 2024-03-10 14:03:27 +01:00
02ae618bf1 Clean up comments. Embrace variables. 2024-03-10 13:31:19 +01:00
dbc9a8b6dd Fix zrep script to correctly load addons by moving the 'done' statement inside the 'if' block. 2024-03-10 10:02:08 +01:00
2ebb0fd3b7 Update zrep logo in README.md
Enhance version string color in zrep script
Add bold style to version number in zrep script
Fix autoload command in zrep script
Improve color styling for active/inactive packages in zrep script
2024-03-10 09:49:34 +01:00
cb15f80042 Update README.md 2024-03-09 09:12:02 +01:00
4b6eb5734c revert d7e0a5ec4c
revert Update README.md
2024-03-09 09:09:28 +01:00
d7e0a5ec4c Update README.md 2024-03-09 09:08:51 +01:00
5562ae7986 Update zrep initialization to use ZREP_CONFIG variable for configuration file path. Prompt user for zrep installation directory if ZREP_CONFIG doesn't exist. Add source command for .zrep_addons in .zshrc if not present. Create or update .zrep_addons file with addon handling logic. Modify zrep_enable and zrep_disable functions to use ZREP_CONFIG variable. Update main function to call zrep_load_config. Ensure proper sourcing of .zrep_addons after enabling/disabling packages. Include necessary error handling and informative messages. - Sat, 09 Mar 2024 00:36:09 +0100 2024-03-09 00:36:09 +01:00
5f7c437701 Update zrep script with color definitions using associative array and refactor color usage in functions. Add functionality to display package-specific help from USAGE file. - Wed, 06 Mar 2024 18:33:14 +0100 2024-03-06 18:33:14 +01:00
e3ee9e49a9 Update zrep script:
- Commented out unused variables and echo statements.
- Added check to create installed.json if not exists.
- Improved jq command to update installed.json.
- Refactored zrep_list_installed_packages function.
- Refactored zrep_list_package function to concatenate package names.
- Updated zrep_install_package to use a temporary directory.
- Refactored zrep_enable and zrep_disable functions.
- Added zrep_parse_package_name function for package name parsing. - Mon, 04 Mar 2024 23:40:02 +0100
2024-03-04 23:40:02 +01:00
d1f2b04d5b Update zrep script:
- Added `zrep_main_version_string` function to display version string.
- Modified `zrep_remove_package` function to safely remove directories and update `installed.json`.
- Updated `zrep_help` function to include `enable` and `disable` commands.
- Minor formatting improvements and code cleanup. - Mon, 04 Mar 2024 22:36:49 +0100
2024-03-04 22:36:49 +01:00
469ff49206 Add zrep_enable and zrep_disable functions
- Added zrep_enable function to enable packages in zsh
- Added zrep_disable function to disable packages in zsh
- Updated zrep_help function to include enable and disable commands
- Updated main function to handle enable and disable commands
- Minor formatting and comment improvements in zrep script - Mon, 04 Mar 2024 22:17:21 +0100
2024-03-04 22:17:21 +01:00
bc1c7f4e4f Fix directory removal logic in zrep_remove_package function
- Corrected the logic to check if the first letter directory is empty before deletion
- Updated the README with work-in-progress status and a call for help and feedback - Mon, 04 Mar 2024 20:34:23 +0100
2024-03-04 20:34:23 +01:00
ad7ef3d777 - Refactored zrep_list_installed_packages function to display package status (Active/Inactive).
- Updated zrep_remove_package function to remove package from installed.json after successful removal.
- Added zrep_install_package function to download and install packages from a remote server.
- Minor code cleanup and formatting improvements. - Mon, 04 Mar 2024 20:20:33 +0100
2024-03-04 20:20:33 +01:00
720fc65095 Create space - Fri, 01 Mar 2024 12:22:39 +0100 2024-03-01 12:22:39 +01:00
588848b644 Lots of changes to a few functions - Thu, 29 Feb 2024 16:53:22 +0100 2024-02-29 16:53:22 +01:00
cd6e4c51b5 Let's see 2024-02-29 06:49:06 +01:00
03c4f9fcaf Big update. The frontend is close to working. - Wed, 28 Feb 2024 23:41:09 +0100 2024-02-28 23:41:09 +01:00
6 changed files with 1025 additions and 91 deletions

View File

@ -1,3 +1,39 @@
# zrep
<img src="zrep-logo.png" width="150" align="left">
The Zsh Repository tool, akin to PyPi and pip
# Zsh Repository Tool (zrep)
zrep is a powerful and user-friendly package manager for the Zsh shell. It allows you to easily install, manage, and share Zsh packages, such as plugins, themes, and scripts, directly from a central repository.
## What is it?
`zrep` in and of itself is the command line tool that you use to install and manage scripts that are placed in `$fpath` used by Zsh. The packages are available on [the zrep website](https://zrep.kekepower.com) where you can, if you want to share your own scripts, register for an account. By sharing your scripts with the community, you are probably making somebody's day easier.
You can read more in the Wiki.
## Key Features
- **Easy Installation**: zrep simplifies the process of installing Zsh packages. With a single command, you can install packages from the zrep repository.
- **Package Management**: zrep provides a set of commands to manage your installed packages. You can list, enable, disable, update, and remove packages effortlessly.
- **Centralized Repository**: All packages are stored in a central repository, making it convenient to discover and share Zsh packages with the community.
- **Automatic Setup**: zrep automatically sets up the necessary configuration files and directories, ensuring a smooth integration with your Zsh environment.
- **Customizable**: zrep allows you to customize the installation directory and other settings through a configuration file.
## Getting Started
To start using zrep, simply run the `zrep init` command to initialize the tool. zrep will guide you through the setup process and create the required configuration files.
Use the search function on **[the zrep website](https://zrep.kekepower.com)** to find useful scripts until a search function is added to the `zrep` script some time in the future.
Once initialized, you can explore and install packages using commands like `zrep install <author/package>`, `zrep list`, and `zrep enable <author/package>`.
## Contributing
zrep is an open-source project, and contributions are welcome! If you have any ideas, bug reports, or feature requests, please open an issue on the GitHub repository.
## License
zrep is released under the MIT License.

View File

@ -1,43 +0,0 @@
autoload -Uz zini
echo "zrep_init: FPATH: $fpath"
# Initialize zrep
zrep_init() {
local config_file="$HOME/.zreprc"
local zshrc_file="$HOME/.zshrc"
local install_dir
# Check if .zreprc exists
if [[ ! -f $config_file ]]; then
echo "$config_file not found. Creating it..."
# Prompt user for install directory
read "?Enter zrep installation directory [$HOME/.zrep]: " install_dir
install_dir=${install_dir:-$HOME/.zrep}
# Write to .zreprc
echo "[main]" > $config_file
echo "zrep_install_dir = $install_dir" >> $config_file
else
echo "Running zini $config_file"
zini $config_file
echo "Setting install_dir"
install_dir=${config[zrep_install_dir]}
echo "install_dir=${install_dir}"
fi
# Ensure zrep_install_dir exists
mkdir -p "$install_dir"
# Update or add fpath in .zshrc, ensuring no duplicate or empty entries
if ! grep -q "fpath=(.*$install_dir)" "$zshrc_file"; then
echo "Adding zrep installation directory to fpath in .zshrc..."
echo "fpath=('$install_dir' \$fpath)" >> "$zshrc_file"
if ! grep -q "^export fpath" "$zshrc_file"; then
echo "export fpath" >> "$zshrc_file"
fi
else
echo "zrep installation directory ($install_dir) is already included in fpath."
fi
source ${zshrc_file}
echo "zrep initialization complete."
}

34
t Executable file
View File

@ -0,0 +1,34 @@
#!/usr/bin/zsh
function zrep_fpath_2() {
local base_dir="${1}"
# Ensure globbing finds dotfiles and nullglob avoids empty directory issues
setopt local_options dotglob nullglob
# Check if the base directory exists
if [[ ! -d "${base_dir}" ]]; then
echo "Error: Base directory '${base_dir}' does not exist."
return 1
fi
# Iterate over directories within $base_dir with exactly one character
for one_char_dir in ${base_dir}/?; do
# Check if it's indeed a directory
[[ -d "${one_char_dir}" ]] || continue
# Recursively find all final directories under one_char_dir with the pattern first_letter/author/script
for script_dir in ${one_char_dir}/*/*(/); do
local script_name=$(basename "${script_dir}")
local matching_files=("${script_dir}/${script_name}")
# Check if there's at least one file matching the script directory's name
if (( ${#matching_files} )); then
echo "${script_dir}"
fi
done
done
}
zrep_fpath_2 /home/stig/.zrep

10
themes/classic Normal file
View File

@ -0,0 +1,10 @@
# Classic zrep theme
declare -A theme_colors=(
[std]="green"
[info]="yellow"
[debug]="red"
[other]="bold_yellow"
[sub]="magenta"
[main]="white green_bg" # Combining colors for 'main'
[help]="bold_green"
)

989
zrep

File diff suppressed because it is too large Load Diff

BIN
zrep-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB