Code Monkey home page Code Monkey logo

command-not-found's Introduction

Command-not-found for termux

This repo contains sources for the command-not-found utility used in termux. Apart from the sources for the binary (command-not-found.cpp), it also contains lists of commands for the various official repositories:

in subfolders, and scripts (update_command_list.sh, modify_command_list.py) for handling these lists.

Building command-not-found

To build the package, cmake and a c++ compiler (for example g++ or clang++) needs to be installed. To do an out of source build, run these commands from the command-not-found directory:

mkdir build && cd build
cmake ..
make

This will create a command-not-found binary which can be tested directly. To then install the program, run:

make install

This installs command-not-found to CMAKE_INSTALL_PREFIX/libexec/termux, which is where command-not-found resides in termux.

Updating the command lists

To generate new lists of commands you first need to update the submodule to the commit you want to use. To update all repos to the latest commit available, run

git submodule update --init --remote

or to just update a single repo to the latest commit, run

git submodule update --init --remote <repo>

If you do not want to use the latest commit you can checkout another one by running, from the command-not-found main folder:

cd <repo>/<repo>
git checkout <commit-number>

Now that the submodules are at the correct commits, update_command_list.sh can be run. The script uses the previously checked in command list (<repo>/commands-<arch>-<commit>.h) and checks which packages have been updated between that commit and the currently checked out one. It then downloads these deb archives (unless they already exist in the $TERMUX_TOPDIR/_cache-<arch>-folder), creates new command lists and then modifies command-not-found.cpp to use the new lists. To update the lists, run:

./update_command_lists.sh <repo, or 'all'>

This might take a while since it needs to download a lot of deb archives. After this finishes the new command lists, and updated command-not-found.cpp, can be checked into git, and the old lists removed. This can be done with:

# Remove currently checked in command lists
git rm $(git ls-files <repo>/commands-*.h)
# Add new command lists and updated submodule
git add <repo>
# Add command-not-found.cpp, pointing to the new command lists
git add command-not-found.cpp
# Check in into git, with some message
git commit

command-not-found's People

Contributors

grimler91 avatar sylirre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.