Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bulletin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Personal Projects
bulletin
Commits
9a012a54
Unverified
Commit
9a012a54
authored
2 months ago
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
More help text stuff
parent
5bb2ae00
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
dclish/dclish.go
+14
-9
14 additions, 9 deletions
dclish/dclish.go
repl/command.go
+0
-57
0 additions, 57 deletions
repl/command.go
repl/help.go
+60
-2
60 additions, 2 deletions
repl/help.go
with
74 additions
and
68 deletions
dclish/dclish.go
+
14
−
9
View file @
9a012a54
...
@@ -14,6 +14,7 @@ type Flag struct {
...
@@ -14,6 +14,7 @@ type Flag struct {
Value
string
Value
string
Default
string
Default
string
Description
string
Description
string
// TODO: Toggle bool
}
}
// Flags is the list of flags.
// Flags is the list of flags.
...
@@ -22,7 +23,10 @@ type Flags map[string]*Flag
...
@@ -22,7 +23,10 @@ type Flags map[string]*Flag
// Command contains the definition of a command, it's flags and subcommands.
// Command contains the definition of a command, it's flags and subcommands.
type
Command
struct
{
type
Command
struct
{
Flags
Flags
Flags
Flags
// TODO: FlagOrder []string
Args
[]
string
Args
[]
string
// TODO: MaxArgs int
// TODO: MinArgs int
Commands
[]
*
Command
Commands
[]
*
Command
Action
ActionFunc
Action
ActionFunc
Description
string
Description
string
...
@@ -52,18 +56,19 @@ func (c Commands) ParseAndRun(line string) error {
...
@@ -52,18 +56,19 @@ func (c Commands) ParseAndRun(line string) error {
return
cmd
.
Action
(
cmd
)
return
cmd
.
Action
(
cmd
)
}
}
// TODO: need to clean this up.
// TODO: need to clean this up.
for
i
:=
range
words
[
1
:
]
{
args
:=
words
[
1
:
]
if
strings
.
HasPrefix
(
words
[
i
],
"/"
)
{
for
i
:=
range
args
{
flag
,
val
,
assigned
:=
strings
.
Cut
(
words
[
i
],
"="
)
if
strings
.
HasPrefix
(
args
[
i
],
"/"
)
{
flag
,
val
,
assigned
:=
strings
.
Cut
(
args
[
i
],
"="
)
if
assigned
{
if
assigned
{
wordup
:=
strings
.
ToUpper
(
flag
)
wordup
:=
strings
.
ToUpper
(
flag
)
flg
,
ok
:=
cmd
.
Flags
[
wordup
]
flg
,
ok
:=
cmd
.
Flags
[
wordup
]
if
!
ok
{
if
!
ok
{
fmt
.
Printf
(
"ERROR: Flag '%s' not recognised."
,
word
s
[
i
])
fmt
.
Printf
(
"ERROR: Flag '%s' not recognised."
,
arg
s
[
i
])
}
}
flg
.
Value
=
val
flg
.
Value
=
val
}
else
{
}
else
{
wordup
:=
strings
.
ToUpper
(
word
s
[
i
])
wordup
:=
strings
.
ToUpper
(
arg
s
[
i
])
value
:=
"true"
value
:=
"true"
if
strings
.
HasPrefix
(
wordup
,
"/NO"
)
{
if
strings
.
HasPrefix
(
wordup
,
"/NO"
)
{
wordup
=
strings
.
Replace
(
wordup
,
"/NO"
,
"/"
,
1
)
wordup
=
strings
.
Replace
(
wordup
,
"/NO"
,
"/"
,
1
)
...
@@ -71,12 +76,12 @@ func (c Commands) ParseAndRun(line string) error {
...
@@ -71,12 +76,12 @@ func (c Commands) ParseAndRun(line string) error {
}
}
flg
,
ok
:=
cmd
.
Flags
[
wordup
]
flg
,
ok
:=
cmd
.
Flags
[
wordup
]
if
!
ok
{
if
!
ok
{
fmt
.
Printf
(
"ERROR: Flag '%s' not recognised."
,
word
s
[
i
])
fmt
.
Printf
(
"ERROR: Flag '%s' not recognised."
,
arg
s
[
i
])
}
}
flg
.
Value
=
value
flg
.
Value
=
value
}
}
}
else
{
}
else
{
cmd
.
Args
=
append
(
cmd
.
Args
,
word
s
[
i
])
cmd
.
Args
=
append
(
cmd
.
Args
,
arg
s
[
i
])
}
}
}
}
return
cmd
.
Action
(
cmd
)
return
cmd
.
Action
(
cmd
)
...
...
This diff is collapsed.
Click to expand it.
repl/command.go
+
0
−
57
View file @
9a012a54
...
@@ -552,17 +552,6 @@ folder at the other node is also a SYSTEM folder.
...
@@ -552,17 +552,6 @@ folder at the other node is also a SYSTEM folder.
},
},
},
},
},
},
"Ctrl-C"
:
{
Description
:
`Except for when BULLETIN is awaiting input from the terminal, a
CTRL-C will cause BULLETIN to abort the execution of any command. If
BULLETIN is waiting for terminal input, a CTRL-C will cause BULLETIN
to return to the BULLETIN> prompt. If for some reason the user wishes
to suspend BULLETIN, CTRL-Y will usually do so. However, this is not
always true, as BULLETIN will ignore the CTRL-Y if it has a data file
opened at the time. (Otherwise it would be possible to put the files
in a state such that they would be inaccessible by other users.)
`
,
},
"CURRENT"
:
{
"CURRENT"
:
{
Description
:
`Displays the beginning of the message you are currently reading. If
Description
:
`Displays the beginning of the message you are currently reading. If
you are reading a long message and want to display the first part
you are reading a long message and want to display the first part
...
@@ -835,52 +824,6 @@ file exists, the file would be appended to that file.
...
@@ -835,52 +824,6 @@ file exists, the file would be appended to that file.
},
},
"FORWARD"
:
{
"FORWARD"
:
{
Description
:
`Synonym for MAIL command.
Description
:
`Synonym for MAIL command.
`
,
},
"Folders"
:
{
Description
:
`All messages are divided into separate folders. The default folder is
GENERAL. New folders can be created by any user. As an example, the
following creates a folder for GAMES related messages:
BULLETIN> CREATE GAMES
Enter a one line description of folder.
GAMES
To see the list of available folders, use DIRECTORY/FOLDERS. To select
a specific folder, use the SELECT command.
If a user selects a folder and enters the SET READNEW command, that
user will be alerted of topics of new messages at login time, and will
then be given the option of reading them. Similar to READNEW is SHOWNEW,
which displays the topics but doesn't prompt to read them. Even less is
SET BRIEF, which will cause only a one line output indicating that there
are new messages in the folder. There also is the SET NOTIFY option,
which will cause a message to be broadcast to a user's terminal alerting
the user that a new message has been added. Any of these options can be
the default for the folder by using the /DEFAULT switch on the command.
A folder can be restricted to only certain users, if desired. This is
done by specifying CREATE/PRIVATE. Afterwards, access to the folder is
controlled by the creator by the SET [NO]ACCESS command. If /SEMIPRIVATE
rather than /PRIVATE is specified, all users can read the messages in the
folder, but only those give access can add messages.
A folder can be converted into a remote folder using CREATE/NODE or SET
NODE. A remote folder is one which points to a folder on a remote DECNET
node. Messages added to a remote node are actually stored on the folder
on the remote node. The BULLCP process (created by BULLETIN/STARTUP)
must be running on the remote node for this option to be used.
A folder can be specified as a SYSTEM folder, i.e. one in which SYSTEM/
SHUTDOWN/BROADCAST messages can be added. By default, the GENERAL folder
is a SYSTEM folder (and cannot be changed). One use for this is to create
a remote SYSTEM folder which is shared by all nodes, so that the GENERAL
folder is used for messages pertaining only to the local host, while the
remote folder is used for messages pertaining to all nodes. Another
use is to create a folder for posting SYSTEM messages only meant for a
certain UIC group. This is done by creating a PRIVATE SYSTEM folder, and
giving access to that UIC group. Only users in that UIC group will see
the messages in that folder when they log in.
`
,
`
,
},
},
"HELP"
:
{
"HELP"
:
{
...
...
This diff is collapsed.
Click to expand it.
repl/help.go
+
60
−
2
View file @
9a012a54
...
@@ -8,7 +8,66 @@ import (
...
@@ -8,7 +8,66 @@ import (
"git.lyda.ie/kevin/bulletin/dclish"
"git.lyda.ie/kevin/bulletin/dclish"
)
)
var
helpmap
map
[
string
]
string
var
helpmap
=
map
[
string
]
string
{
"FOLDERS"
:
`All messages are divided into separate folders. The default folder is
GENERAL. New folders can be created by any user. As an example, the
following creates a folder for GAMES related messages:
BULLETIN> CREATE GAMES
Enter a one line description of folder.
GAMES
To see the list of available folders, use DIRECTORY/FOLDERS. To select
a specific folder, use the SELECT command.
If a user selects a folder and enters the SET READNEW command, that
user will be alerted of topics of new messages at login time, and will
then be given the option of reading them. Similar to READNEW is SHOWNEW,
which displays the topics but doesn't prompt to read them. Even less is
SET BRIEF, which will cause only a one line output indicating that there
are new messages in the folder. There also is the SET NOTIFY option,
which will cause a message to be broadcast to a user's terminal alerting
the user that a new message has been added. Any of these options can be
the default for the folder by using the /DEFAULT switch on the command.
A folder can be restricted to only certain users, if desired. This is
done by specifying CREATE/PRIVATE. Afterwards, access to the folder is
controlled by the creator by the SET [NO]ACCESS command. If /SEMIPRIVATE
rather than /PRIVATE is specified, all users can read the messages in the
folder, but only those give access can add messages.
A folder can be converted into a remote folder using CREATE/NODE or SET
NODE. A remote folder is one which points to a folder on a remote DECNET
node. Messages added to a remote node are actually stored on the folder
on the remote node. The BULLCP process (created by BULLETIN/STARTUP)
must be running on the remote node for this option to be used.
A folder can be specified as a SYSTEM folder, i.e. one in which SYSTEM/
SHUTDOWN/BROADCAST messages can be added. By default, the GENERAL folder
is a SYSTEM folder (and cannot be changed). One use for this is to create
a remote SYSTEM folder which is shared by all nodes, so that the GENERAL
folder is used for messages pertaining only to the local host, while the
remote folder is used for messages pertaining to all nodes. Another
use is to create a folder for posting SYSTEM messages only meant for a
certain UIC group. This is done by creating a PRIVATE SYSTEM folder, and
giving access to that UIC group. Only users in that UIC group will see
the messages in that folder when they log in.`
,
"Ctrl-C"
:
`Except for when BULLETIN is awaiting input from the terminal, a
CTRL-C will cause BULLETIN to abort the execution of any command. If
BULLETIN is waiting for terminal input, a CTRL-C will cause BULLETIN
to return to the BULLETIN> prompt. If for some reason the user wishes
to suspend BULLETIN, CTRL-Y will usually do so. However, this is not
always true, as BULLETIN will ignore the CTRL-Y if it has a data file
opened at the time. (Otherwise it would be possible to put the files
in a state such that they would be inaccessible by other users.)
`
,
}
func
init
()
{
for
c
:=
range
commands
{
helpmap
[
c
]
=
commands
[
c
]
.
Description
}
}
// ActionHelp handles the `HELP` command.
// ActionHelp handles the `HELP` command.
func
ActionHelp
(
cmd
*
dclish
.
Command
)
error
{
func
ActionHelp
(
cmd
*
dclish
.
Command
)
error
{
...
@@ -19,7 +78,6 @@ func ActionHelp(cmd *dclish.Command) error {
...
@@ -19,7 +78,6 @@ func ActionHelp(cmd *dclish.Command) error {
wordup
:=
strings
.
ToUpper
(
cmd
.
Args
[
0
])
wordup
:=
strings
.
ToUpper
(
cmd
.
Args
[
0
])
helptext
,
ok
:=
helpmap
[
wordup
]
helptext
,
ok
:=
helpmap
[
wordup
]
if
!
ok
{
if
!
ok
{
// TODO: add a help structure for topics that are not command.
fmt
.
Printf
(
"ERROR: Topic not found: '%s'.
\n
"
,
cmd
.
Args
[
0
])
fmt
.
Printf
(
"ERROR: Topic not found: '%s'.
\n
"
,
cmd
.
Args
[
0
])
return
nil
return
nil
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment