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

update -h and update -v make the Bash prompt appear in bold. #15

Closed
AntonVanAssche opened this issue Jun 23, 2022 · 7 comments
Closed

Comments

@AntonVanAssche
Copy link
Contributor

Describe the bug
Running the script with the -h flag to display the help message will make the Bash prompt appear in bold as well. The same happens when using the -v flag to display the version number.

To Reproduce
Steps to reproduce the behavior:

  1. Execute ./update -h
  2. Execute ./update -v

Expected behavior
Shows the help message and the version number without changing the Bash prompt.

Screenshots
Screenshot from 2022-06-23 18-36-03
Screenshot from 2022-06-23 18-36-29

System information:

  • OS: Fedora Linux (36)
  • Version: v1.3.9

Additional context
I suspect there is a few ${NC} missing in the code.
I can make a pull request to resolve this if you'd like.

@Crilum
Copy link
Owner

Crilum commented Jun 28, 2022

Sorry for the late response.. I haven't been on much lately.
I'll take a look at the code, it probably is a missing ${NC} escape code..

@Crilum
Copy link
Owner

Crilum commented Jun 28, 2022

Ok, I think I fixed it. Try updating (update -u) and running update -h (or -v).

On a different note, does installing and uninstalling update work alright for you on Fedora? I mainly use Debian, so I haven't been able to test update on Fedora very much...

@AntonVanAssche
Copy link
Contributor Author

update -h works fine, only when using sudo or doas (Basically when running the program as root) the problem still appears.
update -u works perfectly.

Screenshot from 2022-06-28 21-03-01

I suggest you do something like this to fix it.

function help() {

    echo -e "\n${LICYAN}update ${WHITE}version ${YELLOW}${version} ${WHITE}| created by ${LIBLUE}Crilum\n
${WHITE}Usage: ${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}OPTIONS${NC}${WHITE}
These are the main options/arguments for ${CYAN}${BOLD}update${NC}${WHITE}:
${CYAN}${BOLD}update${YELLOW}${BOLD} apt · -a · --apt [packages]${NC}         ${WHITE}Updates apt packages
${CYAN}${BOLD}update ${YELLOW}${BOLD}all · -A · --all${NC}      		   ${WHITE}Updates apps on all installed package managers and/or app stores that are supported ${NC}- ${LIRED}Note: This option does not update NPM packages because this can cause trouble.
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}pi-apps · -p · --pi-apps${NC}            ${WHITE}Updates Pi-Apps, and apps installed with Pi-Apps
${CYAN}${BOLD}update ${YELLOW}${BOLD}npm · -n · --npm${NC}       		   ${WHITE}Updates all npm packages
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}snaps · -s · --snaps [snaps]${NC}        ${WHITE}Updates snaps with snapd
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}flatpak · -f · --flatpak [packages] ${NC}${WHITE}Updates flatpak apps
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}homebrew · -H · --homebrew${NC}          ${WHITE}Updates Homebrew apps
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}pacman · -c · --pacman [packages]   ${NC}${WHITE}Updates pacman apps
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}dnf · -d · --dnf${NC}       	           ${WHITE}Updates dnf packages
${CYAN}${BOLD}update ${YELLOW}${BOLD}self-update · -u · --self-update${NC}    ${WHITE}Updates the ${CYAN}${BOLD}update ${WHITE}script
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}help · -h · --help${NC}       	   ${WHITE}Displays this help
${CYAN}${BOLD}update${NC} ${YELLOW}${BOLD}version · -v · --version${NC}       	   ${WHITE}Prints version
flags for ${LICYAN}update${WHITE}:
      ${YELLOW}${BOLD}--no-grep-args${NC}                 	   ${WHITE}If this flag is specified, ${LICYAN}update${WHITE} won't remove arguments that are also packages from the update package list, i.e. 'apt'
${NC}"
    if [ "$(whoami)" == "root" ]; then
        echo -e "${LIRED}Note: \`${LICYAN}update${LIRED}\` is not meant to be run with \`${WHITE}sudo${LIRED}\`. Although \`${LICYAN}update${LIRED}\` can be run with \`${WHITE}sudo${LIRED}\`, it is not recommended.\n${NC}"
    fi
    upd_upd_script on-start
}

@AntonVanAssche
Copy link
Contributor Author

Ok, I think I fixed it. Try updating (update -u) and running update -h (or -v).

On a different note, does installing and uninstalling update work alright for you on Fedora? I mainly use Debian, so I haven't been able to test update on Fedora very much...

Updating the program with update -u works fine.

When I am following the step in the README I am unable to uninstall the program. It gives the following error:

$ sudo alien -r update
Unknown type of package, update.

I've to manually remove it using sudo rm -f /usr/bin/update /usr/bin/up as described in the README.

@Crilum
Copy link
Owner

Crilum commented Jun 28, 2022

Alright, I've just released the version that should be fixed for both root and non-root. Can you test it again? It looks right on my computer.

Updating the program with update -u works fine.

When I am following the step in the README I am unable to uninstall the program. It gives the following error:

$ sudo alien -r update Unknown type of package, update.

I've to manually remove it using sudo rm -f /usr/bin/update /usr/bin/up as described in the README.

Thanks for the feedback.

@AntonVanAssche
Copy link
Contributor Author

AntonVanAssche commented Jun 28, 2022

I opened a new issue (#16) because I found an error when installing update using the provided rpm file. I thought, since this is a different issue, I should open a new issue. Instead of putting it in this one.

@AntonVanAssche
Copy link
Contributor Author

AntonVanAssche commented Jun 28, 2022

Alright, I've just released the version that should be fixed for both root and non-root. Can you test it again? It looks right on my computer.

Alright it seems to be fixed, thank you!

@Crilum Crilum closed this as completed Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants