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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ This moves a file or directory to public API (either the `app/public` folder or
Make sure there are no spaces between the comma-separated list of paths of directories.

## Move files or directories from one pack to another
`bin/packs move packs/destination_pack path/to/file.rb path/to/directory`
`bin/packs move path/to/file.rb path/to/directory packs/destination_pack`

This is used for moving files into a pack (the pack must already exist).
Note this works for moving files to packs from the monolith or from other packs

The last argument is the destination pack. All previous arguments are the paths to move.
Make sure there are no spaces between the comma-separated list of paths of directories.

## Lint `package_todo.yml` files to check for formatting issues
Expand Down
14 changes: 9 additions & 5 deletions lib/packs/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,22 @@ def make_public(*paths)
exit_successfully
end

desc 'move packs/destination_pack path/to/file.rb path/to/directory', 'Move files or directories from one pack to another'
desc 'move path/to/file.rb path/to/directory packs/destination_pack', 'Move files or directories from one pack to another'
long_desc <<~LONG_DESC
This is used for moving files into a pack (the pack must already exist).
Note this works for moving files to packs from the monolith or from other packs

The last argument is the destination pack. All previous arguments are the paths to move.
Make sure there are no spaces between the comma-separated list of paths of directories.
LONG_DESC
sig { params(pack_name: String, paths: String).void }
def move(pack_name, *paths)
sig { params(args: String).void }
def move(*args)
raise StandardError, 'At least two arguments required: source path(s) and destination pack' if args.length < 2

*paths, pack_name = args
Packs.move_to_pack!(
pack_name: pack_name,
paths_relative_to_root: paths
pack_name: T.must(pack_name),
paths_relative_to_root: T.must(paths)
)
exit_successfully
end
Expand Down