Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cmdline import command #2264

Merged
merged 3 commits into from
Jan 30, 2018

Conversation

HebaruSan
Copy link
Member

Background

#2177 created the ability to import manually downloaded files to the cache, as part of ConsoleUI.

#2246 added it for GUI.

Changes

This pull request adds the same import functionality for Cmdline.

$ ckan import --help
CKAN 1.24.0-PRE2+d6a802f8a78c
Copyright © 2014-2017
 
import - Import manually downloaded mods
Usage: ckan import [options] paths

  --ksp              KSP install to use

  --kspdir           KSP dir to use

  -v, --verbose      (Default: False) Show more of what's going on when 
                     running.

  -d, --debug        (Default: False) Show debugging level messages. Implies 
                     verbose

  --debugger         (Default: False) Launch debugger at start

  --net-useragent    Set the default user-agent string for HTTP requests

  --headless         (Default: False) Set to disable all prompts

  --asroot           (Default: False) Allows CKAN to run as root on Linux-based
                     systems

You are using CKAN version v1.24.0-PRE2+d6a802f8a78c
$ ckan import /tmp/B8CF009D-Astrogator-v0.7.8.zip 

Importing B8CF009D-Astrogator-v0.7.8.zip... (0%)Importing Astrogator v0.7.8...
Install 1 compatible imported mods? [Y/n] 
Import complete. Delete 1 old files? [Y/n] 
About to install...

 * Astrogator v0.7.8 (cached)
 * Module Manager 3.0.1 (cached)
 * LoadingTipsPlus V1.5 (cached)

Continue? [Y/n]

If you specify a directory, it'll attempt to import all files in it.

The core function NetModuleCache.Store is also updated to populate a default cache filename of CkanModule.StandardName(), to make them consistent with normally downloaded filenames.

@HebaruSan HebaruSan added Enhancement New features or functionality Cmdline Issues affecting the command line Pull request labels Jan 26, 2018
@politas
Copy link
Member

politas commented Jan 26, 2018

Are we sure we want the --headless default to be delete the old file? Also, can we include the ksp installation name or location in the "Install [x] compatible mods" prompt?

@HebaruSan
Copy link
Member Author

Added the instance name and path to the Y/n prompt.
I'll need to think about the headless question. I had assumed that was mainly for Jenkins scripts.

@HebaruSan
Copy link
Member Author

OK, now we don't prompt for deletion in headless mode.

> ckan import c:\users\user\appdata\local\temp\ckan\09DA68AB-Astrogator-v0.7.8.zip --headless

Importing 09DA68AB-Astrogator-v0.7.8.zip... (0%)Importing Astrogator v0.7.8...
About to install...

 * Astrogator v0.7.8 (cached)
 * Module Manager 3.0.1 (cached)
 * LoadingTipsPlus V1.5 (cached)


Installing mod "Astrogator v0.7.8"
Installing mod "ModuleManager 3.0.1"
Installing mod "LoadingTipsPlus V1.5"
Updating registry
Commiting filesystem changes
Rescanning GameData
Done!

@politas politas merged commit 129b327 into KSP-CKAN:master Jan 30, 2018
politas added a commit that referenced this pull request Jan 30, 2018
@HebaruSan HebaruSan deleted the feature/cmdline-import-downloads branch January 30, 2018 03:38
@HebaruSan HebaruSan mentioned this pull request Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmdline Issues affecting the command line Enhancement New features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants