$ cats nobody@supertxt.net:intro-to-ssc.s.txt

# Introduction to Site-Specific Commands

A site-specific command (SSC) is a program available at the command-line that provides site-specific experience and integrations. Most internet sites that are served in the world-wide-web don't provide a rich client tool that can be run directly on your operating system. Let's see what SSC looks like.

## Nouns

Every internet site is competing with other sites in a global namespace. This is why we have the Domain Name System so that collisions can be managed. As a result internet users have become familiar with the domain names of the sites that they use day-to-day, whether it's "wikipedia.org," or "youtube.com." It's not uncommon for people to type these addresses into their web browser address bars to either go to that site directly, or to constrain the Google search results to that site.

The command-line has similar namespace issues and can make use of the Domain Name System. It turns out that domain names can also be valid command names. So, if we want to get at the rich experience with a particular site we can launch the SSC using that domain name. We can type out the site name, a noun, to get it.

.sh
wikipedia.org # Wikipedia, give me a rich site-specific experience

The nature of the site-specific experience is intentionally left up to the site. It could be a simple command-line experience, or a fully graphical one, perhaps something in between. Some sites may provide a customized signup procedure, payment method, or any variety of things.

## Noun and Verb

Sometimes computer interactions involve a specific thing, with a name (ie. a noun). In the previous section we saw that nouns can be a specific site on the internet with a unique name. It's the verbs that give us a language of what we want to do. So, if we want to do something specific with an internet site then we combine a noun with the verb. Sometimes the verbs are presented in the user interface of the site. That may well depend on the state of the UI, or whether we have already started the program. Sometimes we want to cut through all of that and just run a command that gets us to where we want to go with the full sentence. Let's say that we want to search wikipedia, we can tell it to do that like this:

.txt
wikipedia, search for "space opera"
^^^^^^^^^^ ^^^^^^ ^^^^^^^^^^^^^^^^^
   Noun     Verb      Detail

Turning that into a command-line that can be run by your Operating System might look something like this:

.sh
wikipedia.org srch <<EOF
space opera
EOF

The noun is the site-specific command, fully qualified to avoid namespace collisions with other wikipedias, followed by the verb, which is a subcommand, and the remaining detail, which is the search query. The above command uses a "heredoc" with a token (EOF, in this case) to provide a potentially lengthy bit of detail. This will use the SSC to search Wikipedia for things that match the criteria. Again, it's up to the SSC to provide the rich Wikipedia experience with this sentence. The user communicates their intention by running the command.Sometimes the shell will record these conversations so that they can be repeated.

## Starting with the Verb

Sometimes the verb is the focus of what we want to do and that's not so much focused on a particular place. These are the most common types of commands, such as edit, view, copy, open, or find.

.txt
open "space opera"
^^^^ ^^^^^^^^^^^^^
Verb    Object

Depending on the command, the object being operated on might be local system, remote system using a standard protocol, or site-specific. The command defines the experience in these cases, not the site. But, the site may participate by implementing the remote protocol, or by providing a site-specific integration.

.sh
cats wikipedia.org:Space_Opera.s.txt

The cats protocol expects that the host specific here has SSH, and is able to handle remote execute of "cat" with the file. If the site can handle this request then it can work directly with cats. However, if there is a site-specific way of performing the request, then there needs to be site-specific software to handle that. This is where the SSC can help by providing common verbs as sub-commands. If the cats command detects the presence of the wikipedia SSC on the PATH, then it can try delegating to it so that it can provide the expected function in a site-specific way. Since wikipedia doesn't yet provide either SSH access, or cat for a file on the site, a site specific command could be invoked by cats like this:

.sh
wikipedia.org cats Space_Opera.s.txt

The user doesn't know, or perhaps care, that this is what happens underneath to get their file, search for content, or clone the git repository.

## Wrapping it up

In this article we have looked at some general patterns in the way that people use their command-line, sometimes in site-specific ways (with the noun), or site-independent ways with the focus on the verb that describes what they want to do. For site-specific experiences, there can be an SSC that provides rich user experiences with that internet site. The same command can also provide integrations in site-independent ways by providing support for different verbs. This has the added advantage of being able to integrate on the user's own operating system when the service itself doesn't have support for SSH or the command's protocol on top of that.

HAVE SOME FEEDBACK ON THIS DOCUMENT?

You can provide a conventional comment on this document.

.sh
ssh nobody@supertxt.net ccmnt intro-to-ssc.s.txt <<EOF
suggestion: Here's my actionable suggestion.
EOF