Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F12272633
posts_nix.go
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
793 B
Subscribers
None
posts_nix.go
View Options
// +build !windows
package
main
import
(
"fmt"
"github.com/mitchellh/go-homedir"
"os"
"os/exec"
)
const
(
dataDirName
=
".writeas"
noEditorErr
=
"Couldn't find default editor. Try setting $EDITOR environment variable in ~/.profile"
)
func
parentDataDir
()
string
{
dir
,
err
:=
homedir
.
Dir
()
if
err
!=
nil
{
panic
(
err
)
}
return
dir
}
func
editPostCmd
(
fname
string
)
*
exec
.
Cmd
{
editor
:=
os
.
Getenv
(
"EDITOR"
)
if
editor
==
""
{
// Fall back to default editor
path
,
err
:=
exec
.
LookPath
(
"vim"
)
if
err
!=
nil
{
path
,
err
=
exec
.
LookPath
(
"nano"
)
if
err
!=
nil
{
return
nil
}
}
editor
=
path
}
return
exec
.
Command
(
editor
,
fname
)
}
func
messageRetryCompose
(
fname
string
)
string
{
return
fmt
.
Sprintf
(
"To retry this post, run:\n cat %s | writeas"
,
fname
)
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 6, 5:07 AM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3472949
Attached To
rWCLI writeas-cli
Event Timeline
Log In to Comment