Giter VIP home page Giter VIP logo

memo's Introduction

memo

Memo Life For You

Memo Life For You

Usage

NAME:
   memo - Memo Life For You

USAGE:
   memo [global options] command [command options] [arguments...]

VERSION:
   0.0.4

COMMANDS:
     new, n     create memo
     list, l    list memo
     edit, e    edit memo
     delete, d  delete memo
     grep, g    grep memo
     cat, v     view memo
     config, c  configure
     serve, s   start http server
     help, h    Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Installation

$ go install github.com/mattn/memo@latest

Let's start create memo file.

$ memo new
Title:

Input title for the memo, then you see the text editor launched. After saving markdown, list entries with memo list.

$ memo list
2017-02-07-memo-command.md   : Installed memo command

And grep

$ memo grep command
2017-02-07-memo-command.md:1:# Installed memo command

Configuration

run memo config.

memodir = "/path/to/you/memo/dir" # specify memo directory
memotemplate = "path/to/tmpl.txt" # optional memo template file. default '~/.config/memo/template.txt'
editor = "vim"                    # your favorite text editor
column = 30                       # column size for list command
selectcmd = "peco"                # selector command for edit command
grepcmd = "grep -nH"              # grep command executable
assetsdir = "/path/to/assets"     # assets directory for serve command
pluginsdir = "path/to/plugins"    # plugins directory for plugin commands. default '~/.config/memo/plugins'.

memodir, memotemplate and assetsdir can be used ~/ prefix or $HOME or OS specific environment variables. editor, selectcmd and grepcmd can be used placeholder below.

placeholder replace to
${FILES} target files
${DIR} same as memodir
${PATTERN} grep pattern

Memo Template

You can use memo template using Go's text/template format. A template receives the following attributes.

  • Title
  • Date (format: %Y-%m-%d %H:%M)
  • Categories (always empty)
  • Tags (always empty)

The following is a template example to apply YAML Frontmatter.

---
title: {{.Title}}
date: {{.Date}}
---

{{.Title}}
===========

You can also use glidenote/memolist.vim's template format like following.

title: {{_title_}}
==========
date: {{_date_}}
tags: [{{_tags_}}]
categories: [{{_categories_}}]
----------

Supported GrepCmd

Command Configuration
GNU Grep grepcmd = "grep -nH" #default
ag grepcmd = "ag ${PATTERN} ${DIR}"
jvgrep grepcmd = "jvgrep ${PATTERN} ${DIR}"

Supported SelectCmd

Command Configuration
gof selectcmd = "gof"
cho selectcmd = "cho"
fzf selectcmd = "fzf"

Extend With Plugin Commands

You can extend memo with custom commands. Place an executable file in your pluginsdir, memo can use it as a subcommand. For example, If you place foo file in your pluginsdir, you can run it by memo foo.

Below is spec of plugins:

  • MUST handle -usage option to show briefly, at least.
  • MUST NOT handle --xxx option.
  • MUST NOT use multi-byte strings in the usage.

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

memo's People

Contributors

arikui1911 avatar babarot avatar gmidorii avatar huydx avatar kanata2 avatar kohkimakimoto avatar luv2code avatar mattn avatar mitsugu avatar mitszo avatar renovate-bot avatar robotamer avatar sethwklein avatar songmu avatar squeuei avatar superbrothers avatar syou6162 avatar yosugi avatar yuheitomi avatar zchee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

memo's Issues

Transition from `ioutil.ReadFile` to `os.ReadFile`

Hello Mattn.

I noticed that in recent versions of Go, the ioutil.ReadFile function has been deprecated in favor of os.ReadFile.

Background:

As per Go's documentation, many of the functions provided by ioutil have been moved to other packages (like os, io, etc.) to streamline the standard library and make the intention of functions clearer.

Issue:

Any current usage of ioutil.ReadFile should be transitioned to os.ReadFile to stay updated with best practices and avoid potential issues in the future.

Suggested Changes:

Replace all instances of ioutil.ReadFile with os.ReadFile.

Thank you for your attention to this matter. I believe making this change will ensure our codebase remains up-to-date with Go's recommended practices.

Allow ${HOME} or ~ to specify home in `memodir` config

Please allow ${HOME}, ${XDG_CONFIG_HOME}, and/or ~ in memo's config to specify memodir. For example:

memodir = "${XDG_CONFIG_HOME}/memo/_posts"
memodir = "${HOME}/.config/memo/_posts"
memodir = "~/.config/memo/_posts"

Multiple arguments with `memo delete`

Current behaviour of memo delete is a bit confusing: memo d a b c deletes a, but does not delete b and c.
I'm not sure what should be done when multiple arguments are given. But in my opinion, some warnings should be raised to tell that some arguments are ignored.

Installation fails

anatol@anatol-CT15:~$ go version
go version go1.6.2 linux/amd64

anatol@anatol-CT15:~$ export GOPATH=~/.go
anatol@anatol-CT15:~$ go get github.com/mattn/memo
# github.com/shurcooL/github_flavored_markdown/gfmstyle
.go/src/github.com/shurcooL/github_flavored_markdown/gfmstyle/assets_vfsdata.go:136: undefined: io.SeekStart
.go/src/github.com/shurcooL/github_flavored_markdown/gfmstyle/assets_vfsdata.go:138: undefined: io.SeekCurrent
.go/src/github.com/shurcooL/github_flavored_markdown/gfmstyle/assets_vfsdata.go:140: undefined: io.SeekEnd
.go/src/github.com/shurcooL/github_flavored_markdown/gfmstyle/assets_vfsdata.go:181: undefined: io.SeekStart
anatol@anatol-CT15:~$ ls .go
pkg src

create text file

Thank you for your great works! ๐Ÿ˜„

summary

create text file

now

create only markdown file

expected

create favarite file type

config file

createfiletype = 'txt'  # enable to create text file
listfiletype   = ' * '  # enable to list cmd for every file type
editfiletype   = ' * '  # enable to edit cmd for every file type

view memo

It would be nice if you can view the memo rather having to go and edit it to see the conten, or that feature is there already.

`memo grep` won't work well with Select-String on Windows Powershell

memo g command causes a loop of displaying results when grepcmd is set as below.

grepcmd = "powershell Select-String -Pattern ${PATTERN} -Path ${DIR}/*.md"
  • OS: Windows 10 Pro / Windows 11 Pro
  • Terminal: Powershell on Windows Terminal

On line 720 of main.go, func cmdGrep has a if block for Windows environment and it seems to be the cause. I don't know why the block is there but I imagine that it's necessary workaround when grep is used on cmd.exe.
Actually, I'm not using grep despite the name of config so that it is very understandable if this issue is regarded as inappropriate. However I would be happy if I can use Select-String here because powershell commands are available on Windows 10/11 by default.
Is there any good way to support both grep and Select-String?

using Ag

Current implementation doesn't allow using ag.

Change format of grepcmd using placeholder like below.

ag ${PATTERN} ${DIR}

or

ag ${PATTERN} ${FILES}

peco

Nice program! I'm on Ubuntu Linux 14.04 -- what is equivalent of peco so I can edit my memo?
Also, is there a way to more simply show the complete memo?
In other words, I create the memo with vim, but it would be nice to have something like this:
memo new
debug
vim edit file and add several lines about debug, then save file.
memo show debug (which would basically cat my vim created file relating to debug)

rename memo

It would be nice if you can view memo and rename.

Install failure

with following message:

package github.com/urfave/cli/v2: cannot find package "github.com/urfave/cli/v2" in any of:
        c:\go\src\github.com\urfave\cli\v2 (from $GOROOT)
        C:\Users\user\go\src\github.com\urfave\cli\v2 (from $GOPATH)

Please check and fix it, thank you.

Installation error when I execute `go get github.com/mattn/memo`

OS

macOS

Go version

go version go1.13.4 darwin/amd64

errror log

go get -u github.com/mattn/memo
# github.com/mattn/memo
/Users/yy_yank/go/src/github.com/mattn/memo/main.go:108:16: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in array or slice literal:
        cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
/Users/yy_yank/go/src/github.com/mattn/memo/main.go:112:18: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
        cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
/Users/yy_yank/go/src/github.com/mattn/memo/main.go:148:16: cannot use cli.BoolFlag literal (type cli.BoolFlag) as type cli.Flag in array or slice literal:
        cli.BoolFlag does not implement cli.Flag (Apply method has pointer receiver)
/Users/yy_yank/go/src/github.com/mattn/memo/main.go:160:18: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
        cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)
/Users/yy_yank/go/src/github.com/mattn/memo/main.go:295:15: cannot use commands (type []cli.Command) as type []*cli.Command in assignment

Similar issue?

swaggo/swag#556

I tried to fix.
It seems to solve when modify dependency in Gopkg.toml.

OK:

[[constraint]]
  name = "github.com/urfave/cli"
-  version = "1.20.0"
+  version = "1.22.1"

NG:

[[constraint]]
  name = "github.com/urfave/cli"
-  version = "1.20.0"
+  version = "1.22.2"

ๅˆๅ›ž่ตทๅ‹•ๆ™‚ใซvimใ‚ณใƒžใƒณใƒ‰ใŒ็„กใ„ใจไฝ•ใ‚‚ใงใใชใ„

ๅ•้กŒ

ใƒ‡ใƒ•ใ‚ฉใƒซใƒˆใฎใ‚จใƒ‡ใ‚ฃใ‚ฟใŒ"vim"ใชใฎใงvimใ‚ณใƒžใƒณใƒ‰ใŒ็„กใ„็’ฐๅขƒใงใฏๅˆฉ็”จ้–‹ๅง‹ใŒ้›ฃใ—ใ„

็’ฐๅขƒ

cmd.exeใŠใ‚ˆใณshใ‹ใ‚‰"vim"ใŒ่ฆ‹ใˆใชใ„็’ฐๅขƒ
nvimใ‚„emacsใ—ใ‹ๅ…ฅใฃใฆใ„ใชใ„ๅ ดๅˆใชใฉ

ๅฏพๅ‡ฆๆณ•

ใƒ‡ใƒ•ใ‚ฉใƒซใƒˆใ‚จใƒ‡ใ‚ฃใ‚ฟใ‚’ๆŒ‡ๅฎšใงใใ‚‹ใ‚ˆใ†ใซใ™ใ‚‹

ๅ…ทไฝ“็š„ใซใฏใ€memoใ‚ณใƒžใƒณใƒ‰ใฎใ‚ชใƒ—ใ‚ทใƒงใƒณใงๆŒ‡ๅฎšใงใใ‚‹ใ‚ˆใ†ใซใ™ใ‚‹ใ€
ใพใŸๅˆๅ›ž่ตทๅ‹•ๆ™‚ใฏEDITOR็’ฐๅขƒๅค‰ๆ•ฐใ‚’่ชญใ‚€ใ‚ˆใ†ใซใ™ใ‚‹ใ€
ใชใฉใŒใ‚ใ‚Šใใ†ใงใ™

memo delete with selector enabled

First of all, thank you for making this tool available to the public. I notice there is a fuzzy matching interface popping up when typing memo edit and memo cat. Does this feature also work for memo delete as well?

The current syntax of memo delete [pattern] works fine but always requires me to find its unique pattern first.

Add config setting for memo filepath format

Please allow to configure the memos filename format, and support creation of subdirectories.

For example, create directories for 'year-month/' and filename with 'day-slug.md':

filefmt = "%Y-%m/%d-${SLUG}.md"

๐Ÿ’ฌ Notice the / in format.

Example of current default:

filefmt = "%Y-%m-%d-${SLUG}.md"

I keep my memos in this fashion:

โ”œโ”€โ”€ 2016-10
โ”‚ย ย  โ””โ”€โ”€ 22-ipsum.md
โ”œโ”€โ”€ 2016-12
โ”‚ย ย  โ”œโ”€โ”€ 11-foo-bar.md
โ”‚ย ย  โ”œโ”€โ”€ 13-bar-baz.md
โ”‚ย ย  โ””โ”€โ”€ 19-lorem.md
โ”œโ”€โ”€ 2017-01
โ”‚ย ย  โ””โ”€โ”€ 05-foo.md
โ””โ”€โ”€ index.md

How can I open files that is including space memodir?

I set following config:

memodir = "C:/Users/tsunomur/OneDrive - Microsoft/memo"
editor = "notepad.exe"
column = 20
width = 0
selectcmd = "peco"
grepcmd = "grep -nH ${PATTERN} ${FILES}"
memotemplate = ""
assetsdir = "."
pluginsdir = "C:/Users/tsunomur/AppData/Roaming/memo/plugins"
templatedirfile = ""
templatebodyfile = ""

When I'm trying "memo edit", and after select a file, I got following error(Sorry for only Japanese):
image

Could you let me know how to write a configuration file to open a file under such a folder?
# I could open when remove call shellquote(file) but it's not correct solution...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.