{"id":13439238,"url":"https://github.com/p-gen/smenu","last_synced_at":"2025-05-14T06:14:32.140Z","repository":{"id":40896777,"uuid":"69188189","full_name":"p-gen/smenu","owner":"p-gen","description":"smenu started as a lightweight and flexible terminal menu generator, but quickly evolved into a powerful and versatile CLI selection tool for interactive or scripting use.","archived":false,"fork":false,"pushed_at":"2025-05-11T12:26:08.000Z","size":9849,"stargazers_count":2398,"open_issues_count":4,"forks_count":51,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-05-11T13:29:40.229Z","etag":null,"topics":["c","cli","command-line","command-line-interface","console","interactive","menus","selection","shell","shell-scripts","terminal","tui"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p-gen.png","metadata":{"files":{"readme":"README.rst","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-25T20:16:11.000Z","updated_at":"2025-05-11T12:26:12.000Z","dependencies_parsed_at":"2024-02-07T21:24:33.938Z","dependency_job_id":"b83ce110-b692-4607-90fa-c986ffb564cf","html_url":"https://github.com/p-gen/smenu","commit_stats":{"total_commits":947,"total_committers":4,"mean_commits":236.75,"dds":"0.0031678986272439813","last_synced_commit":"598a788ab97d1aeae790940df98317d2c1602e16"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-gen%2Fsmenu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-gen%2Fsmenu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-gen%2Fsmenu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p-gen%2Fsmenu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p-gen","download_url":"https://codeload.github.com/p-gen/smenu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254083933,"owners_count":22011905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","cli","command-line","command-line-interface","console","interactive","menus","selection","shell","shell-scripts","terminal","tui"],"created_at":"2024-07-31T03:01:12.237Z","updated_at":"2025-05-14T06:14:32.093Z","avatar_url":"https://github.com/p-gen.png","language":"C","funding_links":[],"categories":["C","Tools","\u003ca name=\"tooling\"\u003e\u003c/a\u003etooling","terminal","cli","Shell","\u003ca name=\"option-picker\"\u003e\u003c/a\u003eFuzzy finders and option pickers","\u003ca id=\"1d9dec1320a5d774dc8e0e7604edfcd3\"\u003e\u003c/a\u003e工具-新添加的","CLI Utilities"],"sub_categories":["C","PCAP","\u003ca id=\"8f1b9c5c2737493524809684b934d49a\"\u003e\u003c/a\u003e文章\u0026\u0026视频"],"readme":"..\n  ###################################################################\n  Copyright 2015, Pierre Gentile (p.gen.progs@gmail.com)\n\n  This Source Code Form is subject to the terms of the Mozilla Public\n  License, v. 2.0. If a copy of the MPL was not distributed with this\n  file, You can obtain one at https://mozilla.org/MPL/2.0/.\n  ###################################################################\n\n.. image:: smenu.gif\n\n|\n\n.. image:: simple_menu.gif\n\nWhat is it?\n===========\n**smenu** is a selection filter just like ``sed`` is an editing filter.\n\nThis tool reads words from standard input or from a file, and presents\nthem to the terminal screen in different layouts in a scrolling window.\nA cursor, easily moved using the **keyboard** and/or the **mouse**,\nmakes it possible to select one or more words.\n\nNote that the screen is not cleared at the start and end of **smenu**\nexecution.\nThe selection window is displayed at the cursor position, and the\nprevious contents of the terminal are neither modified nor lost.\n\nI've tried to make it as easy to use as possible.\nIt should work on all terminals managed in the ``terminfo`` database.\n\n``UTF-8`` encoding is supported.\nThis support includes double-width characters and extended grapheme\nclusters. The latter is still experimental, however, and works much\nbetter if appropriate terminals such as WezTerm or iTerm are used.\n\nThe encoding of ``UTF-8`` glyphs must also be in canonical form, as no\neffort will be made to put them in this form.\n\nPlease refer to the included man page to find out more about this little\nprogram.\n\nThe `wiki \u003chttps://github.com/p-gen/smenu/wiki\u003e`_ contains screenshots and\nanimations that detail some concepts and features of **smenu**.\n\nHow to build it?\n================\nSome Linux distributions already provide **smenu** as a package,\nif not, **smenu** can be built on any system on which a functional\n``terminfo`` development platform is available.\nThis includes all Unix and Unix-like systems that I know of.\n\nPlease use the provided ``build.sh`` script to build the executable.\nThis script uses and accepts the same arguments as the GNU ``configure``\nscript, type ``build.sh --help`` to see them.\n\nHow to install it?\n==================\nOnce the build process is complete, a simple ``make install`` with the\nappropriate privileges will do it.\n\nIssue vs Discussion.\n====================\nI have enabled `discussions \u003chttps://github.com/p-gen/smenu/discussions\u003e`_\non this repository.\n\nI am aware there may be some confusion when deciding where you should\ncommunicate when reporting issues, asking questions or raising feature\nrequests so this section aims to help us align on that.\n\nPlease `raise an issue \u003chttps://github.com/p-gen/smenu/issues\u003e`_ if:\n\n- You have found a bug.\n- You have a feature request and can clearly describe your request.\n\nPlease `open a discussion \u003chttps://github.com/p-gen/smenu/discussions\u003e`_ if:\n\n- You have a question.\n- You're not sure how to achieve something with smenu.\n- You have an idea but don't quite know how you would like it to work.\n- You have achieved something cool with smenu and want to show it off.\n- Anything else!\n\nSome examples.\n==============\n\nLinux example.\n--------------\nThis program should work on most Unix but if you are using Linux,\ntry to type the following line at a shell prompt (here: ``\"$ \"`` ):\n\n::\n\n  $ R=$(grep Vm /proc/$$/status \\\n        | smenu -n20 -W $':\\t\\n' -q -c -b -g -s /VmH)\n  $ echo $R\n\nSomething like this should now be displayed with the program waiting\nfor commands: (numbers are mine, yours will be different)\n\n::\n\n  VmPeak¦    23840 kB\n  VmSize¦    23836 kB\n  VmLck ¦        0 kB\n  VmHWM ¦     2936 kB\n  VmRSS ¦     2936 kB\n  VmData¦     1316 kB\n  VmStk ¦      136 kB\n  VmExe ¦       28 kB\n  VmLib ¦     3956 kB\n  VmPTE ¦       64 kB\n  VmSwap¦        0 kB\n\nA cursor should be under ``\"VmHWM \"``.\n\nAfter having moved the cursor to ``\"      136 kB\"`` and ended the program\nwith ``\u003cEnter\u003e``, the shell variable R should contain: ``\"      136 kB\"``.\n\nUnix example.\n-------------\nThe following command, which is Unix brand agnostic, should give you a\nscrolling window if you have more than 10 accounts on your Unix with a\nUID lower than 100:\n\n::\n\n  $ R=$(awk -F: '$3 \u003c 100 {print $1,$3,$4,$NF}' /etc/passwd \\\n        | smenu -n10 -c)\n  $ echo $R\n\nOn mine (``LANG`` and ``LC_ALL`` set to ``POSIX``) it displays:\n\n::\n\n  at      25 25  /bin/bash      \\\n  sys     0  3   /usr/bin/ksh   +\n  bin     1  1   /bin/bash      |\n  daemon  2  2   /bin/bash      |\n  ftp     40 49  /bin/bash      |\n  games   12 100 /bin/bash      |\n  lp      4  7   /bin/bash      |\n  mail    8  12  /bin/false     |\n  named   44 44  /bin/false     |\n  ntp     74 108 /bin/false     v\n\nNote the presence of a scroll bar.\n\nBash example (CTRL-R replacement)\n---------------------------------\nJust add the following in your ``.bashrc``\n\n::\n\n  EOL=$'\\n'\n  bind -x '\"\\C-r\": READLINE_LINE=$(fc -lr 1                         \\\n                                   | sed \"s/[1-9][0-9]*..//\"        \\\n                                   | smenu -Q -l -a c:7/4,b -W\"$EOL\")\n                   READLINE_POINT=${#READLINE_LINE}'\n\nLaunch or relaunch **bash** and hit ``CTRL-R`` (``CTRL-C`` or ``q``\nto exit), enjoy!\n\nYou can also add the parameter **-d** to instruct **smenu** to clean\nthe selection window after selecting an entry.\n\nWarning for post v0.9.15 versions.\n----------------------------------\nThese versions use a new options system called **ctxopt** which\nmay contain bugs.\nPlease report them so they can be fixed in the next release of **smenu**\nor **ctxopt** (https://github.com/p-gen/ctxopt).\n\nCommand line arguments may also need to be rearranged in some cases\nbecause of this new option management system.\nSorry for the extra work this might entail.\n\nBugs.\n-----\n\nRight-alignment of lines written in right-to-left languages, such as Farsi\nor Hebrew, is not respected.\n\nTesting and reporting.\n----------------------\nThe included testing system is relatively young, please be indulgent.\n\n**IMPORTANT** the testing system has some dependencies, please read the\n``test/README.rst`` before going further.\n\n**NOTE** running all the tests by running ``./tests.sh`` in the\n``tests`` directory will take some time (around 21 min for now).\n\n**NOTE** on some systems like \\*BSD some tests may fail. This can be\nexplained by differences in posix/libc/... implementations.  This can\nnotably occur when some specific regular expressions or uncommon ``UTF-8``\nbyte sequences are used.\n\nIf a test fails for an unknown reason, please send me the name of its\ndirectory and the corresponding ``.bad`` file.\n\nIf you are hit by a bug that no test covers, then you can create a new\ntest in the ``tests`` directory in an existing or new directory: read the\n``tests/README.rst`` file, use an existing test as model, create an\n``.in`` file and a ``.tst`` file and send them to me as well as the\nproduced files.\n\nContributions.\n--------------\nContributions are welcome but discuss your proposal in an issue first,\nor with the maintainer.\n\nSpecial thanks.\n---------------\nI want to thank those who took the time to package **smenu** for their\npreferred operating system or distribution.\nYou will find their names here: https://repology.org/project/smenu/information\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-gen%2Fsmenu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp-gen%2Fsmenu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp-gen%2Fsmenu/lists"}