Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions standards/11-clipboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# *COS 11:* Clipboard

## Quick information
| Information | |
| ----------- | -------------------------------------------------------------------------------------- |
| Version | 1.0.0 |
| Type | Protocol |

### Technical Details
Clipboard defines a method to share information like text with other programs.

It is a Table called "clipboard" in the Shell Environment.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a table called "clipboard" in the shell environment.

Nouns shouldn't be capitalised. There's plenty other instances of this in the document, which I won't comment on to avoid clutter.


#### The Clipboard Table
It is a Table called "clipboard" in the Shell Environment.

| Header | Description |
| ----------- | -------------------------------------------------------------------------------------- |
| type | A String, that Describes, what is in the Clipboard (see at Point "Types") |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describes isn't even a noun... Don't capitalise anything unless it's at the beginning of a sentence or a proper noun (names of people or places, etc.).

| content | This is the Content of the Clipboard see "Types" | |

#### Types
| Type | Content |
| ----------- | -------------------------------------------------------------------------------------- |
| text | Just normal text provided as a String. |
| nfp | A nfp Image provided as String |
| nft | A nft Image provided as String |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have MIME types, just refer to those, it's more flexible.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely


### Usage
Set text of Clipboard:
```lua
clipboard = {type="text",content="Hello World"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This being a global makes my soul scream, but there isn't really an alternative I can think of :/.

```
Get Text of Clipboard
```lua
if type(clipboard) == "table" then
if clipboard.type == "text" then
print(clipboard.content)
end
end
```
1 change: 1 addition & 0 deletions standards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ This document contains a list of all standards.
| 6 | [Nitrogen Fingers Text](6-nft.md) | File format | Images with text support |
| 7 | [Temporary directory](7-temp-directory.md) | File format | Storing temporary files |
| 10 | [TRoR](10-tror.md) | Protocol | Redirecting terminal state and interactions over Rednet. |
| 11 | [Clipboard](11-clipboard.md) | Protocol | Share Informations with other Programs |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Information" should never be plural, it's just "Share information with other programs".