Compare commits
65 Commits
fe7b5544e4
...
main
Author | SHA1 | Date | |
---|---|---|---|
58438a5fdf | |||
36b81d6657 | |||
0372eba263 | |||
d0136a9b19 | |||
933b27b167 | |||
2ccef547a8 | |||
30ffb0f6bb | |||
8569de68ec | |||
aee45ba2ee | |||
ae6becb2cc | |||
8ea89b837b | |||
e37233009c | |||
6399a20ed1 | |||
2e0d42c040 | |||
8f34150a78 | |||
c4c384c799 | |||
d0fed1720e | |||
c3962c72a0 | |||
255649a53e | |||
a64e876b7d | |||
a50a99183b | |||
fcf519dd68 | |||
dd518d733b | |||
7243ae4235 | |||
3345f78b7a | |||
ba1829953c | |||
03adceec67 | |||
7da1c425f4 | |||
3830e58ebb | |||
4337b13a28 | |||
e314131622 | |||
b160120893 | |||
d4e355cf32 | |||
c297c2a551 | |||
c92eb49c05 | |||
17355e5779 | |||
53bd010da6 | |||
de3bb15662 | |||
17c9058be5 | |||
d0210580b1 | |||
40adc05b9b | |||
a492260ec9 | |||
de29949486 | |||
7ddcd309c5 | |||
548012d7cc | |||
4d249d2bf1 | |||
849d4e46a4 | |||
77eb36815b | |||
02ae618bf1 | |||
dbc9a8b6dd | |||
2ebb0fd3b7 | |||
cb15f80042 | |||
4b6eb5734c | |||
d7e0a5ec4c | |||
5562ae7986 | |||
5f7c437701 | |||
e3ee9e49a9 | |||
d1f2b04d5b | |||
469ff49206 | |||
bc1c7f4e4f | |||
ad7ef3d777 | |||
720fc65095 | |||
588848b644 | |||
cd6e4c51b5 | |||
03c4f9fcaf |
40
README.md
40
README.md
@ -1,3 +1,39 @@
|
||||
# zrep
|
||||
<img src="zrep-logo.png" width="150" align="left">
|
||||
|
||||
The Zsh Repository tool, akin to PyPi and pip
|
||||
# Zrep Package Installer (zpi)
|
||||
|
||||
zpi 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?
|
||||
|
||||
`zpi` 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**: zpi simplifies the process of installing Zsh packages. With a single command, you can install packages from the zrep repository.
|
||||
|
||||
- **Package Management**: zpi 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**: zpi automatically sets up the necessary configuration files and directories, ensuring a smooth integration with your Zsh environment.
|
||||
|
||||
- **Customizable**: zpi allows you to customize the installation directory and other settings through a configuration file.
|
||||
|
||||
## Getting Started
|
||||
|
||||
To start using zpi, simply run the `zpi init` command to initialize the tool. zpi 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 `zpi` script some time in the future.
|
||||
|
||||
Once initialized, you can explore and install packages using commands like `zpi install <author/package>`, `zpi list`, and `zpi enable <author/package>`.
|
||||
|
||||
## Contributing
|
||||
|
||||
zpi 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
|
||||
|
||||
zpi is released under the MIT License.
|
||||
|
@ -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."
|
||||
}
|
10
themes/classic
Normal file
10
themes/classic
Normal 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"
|
||||
)
|
84
zrep
84
zrep
@ -1,84 +0,0 @@
|
||||
#!/usr/bin/zsh
|
||||
|
||||
VERSION="0.0.1" # Sat-2024-02-24
|
||||
ZREP="Zsh Repository Tool"
|
||||
|
||||
function zrep_fpath() {
|
||||
local base_dir="$1"
|
||||
|
||||
# Check if the base directory exists
|
||||
if [[ ! -d "$base_dir" ]]; then
|
||||
echo "Error: Base directory '$base_dir' does not exist."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Add directories containing at least one file to fpath
|
||||
for dir in $base_dir/**/*(/N); do
|
||||
if [[ -n $(ls -A "$dir") ]]; then
|
||||
fpath=($dir $fpath)
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
zrep_fpath ${HOME}/bin/include
|
||||
|
||||
autoload -Uz zini
|
||||
|
||||
# Define the path to .zreprc
|
||||
ZREP_CONFIG="$HOME/.zreprc"
|
||||
|
||||
# Function to load configuration
|
||||
function load_config() {
|
||||
autoload -Uz zrep_init
|
||||
if [[ -f "$ZREP_CONFIG" ]]; then
|
||||
# echo ".zreprc found, loading configuration..."
|
||||
zini "$ZREP_CONFIG"
|
||||
zrep_fpath ${config[main_zrep_install_dir]}
|
||||
else
|
||||
if [[ "$1" == "init" ]]; then
|
||||
echo "$ZREP_CONFIG not found. Proceeding with 'zrep init'..."
|
||||
zrep_init
|
||||
else
|
||||
echo "$ZREP_CONFIG not found."
|
||||
# Ask the user if they want to run 'zrep init'
|
||||
read "response?Would you like to run 'zrep init' to set up? (y/n): "
|
||||
if [[ "$response" =~ ^[Yy]$ ]]; then
|
||||
zrep_init
|
||||
else
|
||||
echo "Initialization canceled. Please run 'zrep init' manually to set up."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Main script logic
|
||||
main() {
|
||||
# Load configuration
|
||||
load_config
|
||||
|
||||
# Example command handling structure
|
||||
case "$1" in
|
||||
init)
|
||||
autoload -Uz zrep_init
|
||||
zrep_init
|
||||
zrep_fpath ${config[main_zrep_install_dir]}
|
||||
exit
|
||||
;;
|
||||
install)
|
||||
echo "Install function here"
|
||||
;;
|
||||
update)
|
||||
echo "Update function here"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: zrep <command> [arguments]"
|
||||
echo "Available commands: init, install, update"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Call main with all passed arguments
|
||||
main "$@"
|
||||
|
||||
#echo "END: $fpath"
|
BIN
zrep-logo.png
Normal file
BIN
zrep-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 KiB |
Reference in New Issue
Block a user