pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

add cmd tool: fs2

Open pythonwood opened this issue 5 years ago • 3 comments

Type of changes

  • [ ] Bug fix
  • [x] New feature
  • [ ] Documentation / docstrings
  • [ ] Tests
  • [x] Other

Checklist

  • [ ] I've run the latest black with default args on new code.
  • [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
  • [x] I've added tests for new code.
  • [x] I accept that @willmcgugan may be pedantic in the code review.

Description

fs2 is a command line tool , using click project https://github.com/pallets/click

cd srcdir
pip install .

fs2
Usage: fs2 [OPTIONS] COMMAND [ARGS]...

  This script is pyfilesystem2 command line tool

  example:
      ./fs2 ls .
      ./fs2 -u file://c:/windows ls system32
      ./fs2 -u zip:///tmp/a.zip ls /
      ./fs2 -u tar:///etc/bak.tar.gz  ls opkg config
      ./fs2 -u temp:// ls .
      ./fs2 -u s3:// ls .                                 # pip install fs-s3fs
      ./fs2 -u dropbox:// ls .                            # pip install fs.dropboxfs
      ./fs2 -u webdav://user:[email protected]/web/dav/ ls . # pip install fs.webdavfs
      ./fs2 -u ssh:// ls .                                # pip install fs.sshfs
      ./fs2 --listopener                                  # list all support filesystem

Options:
  -l, --listopener  list supported file system
  -u, --url TEXT    filesystem url: default is "."
  --help            Show this message and exit.

Commands:
  cat    read file and print content.
  cp     copy file (same fs).
  dl     download file to local disk.
  help   print this help msg.
  ls     list files and dirs.
  mkdir  create folders.
  mv     move file (same fs).
  rm     delete file and dirs.
  tree   list files and dirs as tree view.
  up     upload local disk file to remote filesystem.

see also: https://github.com/PyFilesystem/pyfilesystem2/issues/13 https://github.com/PyFilesystem/pyfilesystem2/issues/413

pythonwood avatar Nov 06 '20 10:11 pythonwood

This is awesome @pythonwood

As useful as this is, I don't think it's a good idea for it to go in to the core lib. Purely because any extra code requires additional work to maintain.

What I would suggest is releasing it as a new package with fs as a dependancy. I'd be happy to link to it and promote it...

willmcgugan avatar Nov 06 '20 10:11 willmcgugan

thanks for your suggestion , I will do it that way.

pythonwood avatar Nov 10 '20 13:11 pythonwood

(new name) fscmd is coming soon

first step: fscmd in testpypi

python3 -m pip install --index-url https://test.pypi.org/simple/ fscmd==0.0.2

packaging doc help a lot

next step:

need much improve while packaging

pythonwood avatar Jan 21 '21 07:01 pythonwood

Looks like this ended up at https://github.com/pythonwood/fs2 (for the benefit of anybody looking for this)

lurch avatar Mar 06 '23 13:03 lurch