From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 28890 invoked from network); 1 Aug 2021 17:44:46 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 1 Aug 2021 17:44:46 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id BC4549CA64; Mon, 2 Aug 2021 03:44:44 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 7B2DC9CA63; Mon, 2 Aug 2021 03:44:24 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=case.edu header.i=@case.edu header.b="rh2hJ+7V"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=case.edu header.i=@case.edu header.b="88wOvRhb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=case.edu header.i=@case.edu header.b="bcc+z0RA"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 10DD19CA63; Mon, 2 Aug 2021 03:44:21 +1000 (AEST) Received: from mpv3-2015.case.edu (mpv3-2015.CWRU.Edu [129.22.103.194]) by minnie.tuhs.org (Postfix) with ESMTPS id 5E70F9CA60 for ; Mon, 2 Aug 2021 03:44:19 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1627839859; bh=2QGFvwxWiTCKLfiLurmxI2LGVbdDz6kSrJhI5pJk1ck=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=rh2hJ+7Vg5U77epLII5aSmDBYPVSBtdxxAqEFP96xybjtMYBCtPl8lBfv72tT6fSWB c4B1XBlbbIMuLRnXBMJCySvrtgw8SnEX8GtWKbF8mUhuCVkeB8eoG8EdPrxKHdkHxQC a8OO6f3EA2pxtjsN86Sv0mHTQGuYFAwW10TUpn1wCyH/DKZdY4PWhNK298RgMwxt13J aH+XNk58ZVgwucO400NX6Turu7+CqMJrw/Z3INSelEcxmmaYUYgLV8M/e9Nsdz8WBFm AqeljVNU6JboH2Yz/5hlMD6B0tbjJvRKTLj9yXAXX/53UaLAaipm1SFe7/a8yYmeB8G oMghXTWg== Received: from mpv6-2015.CWRU.Edu (EHLO mpv6-2015.case.edu) ([129.22.103.202]) by mpv3-2015.case.edu (MOS 4.4.8-GA FastPath queued) with ESMTP id BXR70146; Sun, 01 Aug 2021 13:44:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=smtp-primary; t=1627839857; bh=2QGFvwxWiTCKLfiLurmxI2LGVbdDz6kSrJhI5pJk1ck=; h=Reply-To:Cc:Subject:To:References:From:Message-ID:Date: MIME-Version:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=88wOvRhbRByPshv3hBIVbnPdUyeYKwsg+sl7+rMKm9Jy+RfOSpkGqvKbVKE2tq8Bud 0fTMzCnT0O+9zqRGzp6jXw+/4l8L6Dp+nQ03YfzsQ9rhCZbn2Oz5x2l9ebJlisnwjT6 JOu88Ds1g5N752OzAfET0KKUpO0zAQxdNe+ZGjwGGIl/dNM+Tjgo6zKy6z/KlO7cYhe VkVfc6XHoYsT5l1f89BGfE2x9LNdt7UYlQtRW9k/LtTAsInFJi85glJfhkHyG9myaIe 2UYPiC2eE8EaIAbYXSi5v5UbGSVSilmf3+0FWxmZzbqdkoWYdPvLgbLEIBzNLr1Zkbm hU8BBirQ== Received: from mail-qt1-f197.google.com (EHLO mail-qt1-f197.google.com) ([209.85.160.197]) by mpv6-2015.case.edu (MOS 4.4.8-GA FastPath queued) with ESMTP id GJF74566; Sun, 01 Aug 2021 13:44:17 -0400 (EDT) Received: by mail-qt1-f197.google.com with SMTP id l12-20020a05622a050cb029025ca4fbcc12so7250542qtx.18 for ; Sun, 01 Aug 2021 10:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=case.edu; s=g-case; h=reply-to:cc:subject:to:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=hSqKUTExqEqQFNGsRR7ouAIxfnbOJ+XcE1yVTKGtuak=; b=bcc+z0RADfkm9s8RI3+H1BWj1Q8oe4EI96nET8d/0L6YeMC9mxGME+KP09LpRgba0s /k4q3xA2dm0Lu38xeMvSwvXlAcsdVhtWfrdBJM4qs41SvC7vlyMHo2m/WiN6nZUcL6pM L6BWR7z8S22vgflpedQk7o9VL+piFXitjFhdKc0kE9tECA63iQdJuhbGF3KHoNuMNqU+ fleFXPgdGa0pIH6LBFJ8uEQqSP+WnMihz/d3n/xI8OdnTvc1bOKx5U/ThcC7nU5TH1d5 2YvfKqJ0nxnitUZqpu5YGa5U5fu1OfhduC2U2B0RabVMb3q/B83wuELapgvpcqxW44JN EvqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=hSqKUTExqEqQFNGsRR7ouAIxfnbOJ+XcE1yVTKGtuak=; b=UujEMim6nx//SOF0+S90c1Cnk2fmIs0KdLOLxnomW6G4/MWg2tperKXEF4aYEfrODV 1ArO6OjvPKt3TDWWTl2QDKNAx426VeK/yqSfUuOI+24wk+88OwgXXWh9dDtDBu+HrIkE oX0s6qzi+noYcXm0qE22YEpbMEZvJKE8J4bsEyErrSEAZnwVhkzIHMRPP1fr+zZxcfSp 6yt5rrf2HCcBLAu+5CeIma/Mmj9ybIxiRUE/YOcb7fSwg1pXs8uwtqdu3afv/nUKV9u/ bWUOCXtP2GlBQCUEoCnQpWq2fH9l3Vgo5SCLFyJFl9zR3pAdgusPvFnWQ9pDjiKsYXWF mWfQ== X-Gm-Message-State: AOAM531Lyndc1F4f74GJNk4kZAZWmh3RFNO78/V5+64PyI6B7JiBOIA/ xpAtfKPC9ZtrVGp15yHB4MVE5ZpG4yjY4kZSQ+3HJ3/fgfre3IfLZPbMJAObBYYvKN0NjMZ2ZV4 EZ2qH6pxPNFPrgqfi X-Received: by 2002:ac8:51ca:: with SMTP id d10mr10960810qtn.97.1627839856807; Sun, 01 Aug 2021 10:44:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/F2TZ5S/0rW6EKMpTPM0J2U0wgBnXKYtglRDGEUzlWShNwbjsdmbgapoLCrsIO5OxGdqZGA== X-Received: by 2002:ac8:51ca:: with SMTP id d10mr10960789qtn.97.1627839856510; Sun, 01 Aug 2021 10:44:16 -0700 (PDT) Received: from ?IPv6:2603:6010:dc07:54e3:bc89:b2e3:dbe8:235? (2603-6010-dc07-54e3-bc89-b2e3-dbe8-0235.res6.spectrum.com. [2603:6010:dc07:54e3:bc89:b2e3:dbe8:235]) by smtp.gmail.com with ESMTPSA id l4sm4544517qkd.77.2021.08.01.10.44.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Aug 2021 10:44:15 -0700 (PDT) To: Dan Cross , Paul Winalski , Michael Siegel References: <20210731142533.69caf929@moon> From: Chet Ramey Organization: ITS, Case Western Reserve University Message-ID: <40763c2d-52ad-eb01-8bf8-85acf6fee700@case.edu> Date: Sun, 1 Aug 2021 13:44:12 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Mirapoint-IP-Reputation: reputation=Good-1, source=Queried, refid=tid=0001.0A742F92.6106DB48.0005, actions=tag X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A742F1F.6106DD71.002C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2016-11-06 16:00:04, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6b387da3708df4e559b5ac0476e8021c X-Mirapoint-IP-Reputation: reputation=good-1, source=Fixed, refid=n/a, actions=tag X-Junkmail-Status: score=8/80, host=mpv3-2015.case.edu X-Junkmail-PrAS-Raw: score=8/80, refid=2.7.2:2021.8.1.163915:17:8.317, ip=, rules=__YOUTUBE_RCVD, DKIM_SIGNATURE, __X_GOOGLE_DKIM_SIGNATURE, __X_GM_MESSAGE_STATE, __X_GOOGLE_SMTP_SOURCE, __HAS_REPLYTO, __HAS_CC_HDR, __MULTIPLE_RCPTS_CC_X2, __CC_NAME, __CC_NAME_DIFF_FROM_ACC, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __SUBJ_ALPHA_END, __TO_MALFORMED_2, __MULTIPLE_RCPTS_TO_X2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __HAS_REFERENCES, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC2, __RCPT_DOMAIN_NOT_TO, __REPLYTO_SAMEAS_FROM_DOMAIN, __DKIM_ALIGNS_1, __DKIM_ALIGNS_2, __ANY_URI, __URI_MAILTO, __URI_WITH_PATH, __URI_ENDS_IN_SLASH, __URI_NO_WWW, __CP_URI_IN_BODY, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138 Subject: Re: [TUHS] Systematic approach to command-line interfaces X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: chet.ramey@case.edu Cc: TUHS main list Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" On 7/31/21 12:19 PM, Dan Cross wrote: > There was someone posting here on TUHS a while back about leveraging a > special context-sensitive `--shell-help` or similar command line program > and synthesizing a protocol between the shell and a program to provide > TOPS-20 like command completion. It was nowhere near what you get from the > COMND JSYS, but seemed like a reasonable approximation. This is essentially how the existing shells do it (bash, zsh, tcsh, etc.), but in an ad-hoc fashion. There is no standard way to obtain possible completions or list possible arguments, so the shells push that to external generators. Since you have to perform the completion in the shell, there has to be some way to tell the shell the possible completions for each command of interest, whether that's options or arguments. The different shells have solved that in essentially the same way, with a few syntactic variations. Bash provides a framework (complete/compgen/compctl) and pushes a lot of the command-specific work to external completers. It provides access to the shell internals (lists of builtins, functions, aliases, variables, and so on) and built-in ways to perform common completions (filenames, directory names, command names, etc.), and leaves the rest to external commands or shell functions. The real power and flexibility comes from being able to invoke these external commands or shell functions to generate lists of possible completions, and defining an API between the shell and those generators to specify enough of the command line to make it easy to find the word to be completed, the command for which completion is being attempted, and clarifying context around that word. In the same way, the shell provides an API for those generators to return possible completions. The knowledge about each command's options and arguments is embedded in these generators. A standard way to handle command line options and arguments would make generators easier to write, but doesn't address the other issues of what, exactly, the user wants to complete, so the existing mechanisms would likely not change very much. Something like `--shell-help', as long as it were context-sensitive, would help more. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/